Exemplo n.º 1
0
        public double Area(object[] shapes)
        {
            double area = 0;

            foreach (var shape in shapes)
            {
                if (shape is Rectangle_0)
                {
                    Rectangle_0 rectangle = (Rectangle_0)shape;
                    area += rectangle.width * rectangle.height;
                }
            }
            return(area);
        }
Exemplo n.º 2
0
        public double Area(object[] shapes)
        {
            double area = 0;

            foreach (var shape in shapes)
            {
                if (shape is Rectangle_0)
                {
                    Rectangle_0 rectangle = (Rectangle_0)shape;
                    area += rectangle.width * rectangle.height;
                }
                if (shape is Circle_0)
                {
                    Circle_0 circle = (Circle_0)shape;
                    area += (circle.radius * circle.radius) * Math.PI;
                }
            }
            return(area);
        }