Esempio n. 1
0
        static void Main(string[] args)
        {
            ShapeManager  shapeManager = new ShapeManager();
            StringBuilder sb           = new StringBuilder();

            Ellipse   ellipse    = new Ellipse(6, 4, ConsoleColor.Green);
            Rectangle rectangle  = new Rectangle(4, 2);
            Circle    circle     = new Circle(5, ConsoleColor.Red);
            Ellipse   ellipse1   = new Ellipse(3, 1, ConsoleColor.Blue);
            Rectangle rectangle1 = new Rectangle(7, 5);
            Circle    circle1    = new Circle(2, ConsoleColor.DarkCyan);



            shapeManager.AddShape(ellipse);
            shapeManager.AddShape(rectangle);
            shapeManager.AddShape(circle);
            shapeManager.AddShape(ellipse1);
            shapeManager.AddShape(rectangle1);
            shapeManager.AddShape(circle1);

            shapeManager.Save(sb);
            Console.WriteLine($"Area of the rectangle is: {rectangle.CompareTo(ellipse)} then the area of the ellipse");
            Console.WriteLine($"Area of the ellipse is: {ellipse.CompareTo(rectangle)} then the area of the rectangle");
            shapeManager.DisplayAll();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            ShapeManager shapeManager = new ShapeManager();

            Ellipse   ellipse    = new Ellipse(6, 4, ConsoleColor.Green);
            Rectangle rectangle  = new Rectangle(4, 2);
            Circle    circle     = new Circle(5, ConsoleColor.Red);
            Ellipse   ellipse1   = new Ellipse(3, 1, ConsoleColor.Blue);
            Rectangle rectangle1 = new Rectangle(7, 5);
            Circle    circle1    = new Circle(2, ConsoleColor.DarkCyan);

            shapeManager.AddShape(ellipse);
            shapeManager.AddShape(rectangle);
            shapeManager.AddShape(circle);
            shapeManager.AddShape(ellipse1);
            shapeManager.AddShape(rectangle1);
            shapeManager.AddShape(circle1);

            shapeManager.DisplayAll();
        }