Пример #1
0
        static void Main(string[] args)
        {
            // Create a rectangle centered at (5,5) with length and width of 1 and 4
            Shapes.Rectangle r = new Shapes.Rectangle(1, 4, 5, 5);
            // Create a square centered at (4,4) with length of 2 in both dimension
            Shapes.Square s = new Shapes.Square(2, 4, 4);
            // Create a circle centered at (0,0) with a radius of 4
            Shapes.Circle c = new Shapes.Circle(4, 0, 0);
            Console.WriteLine("The height of the rectangle is " + r.xLength + " and the width is " + r.yLength + " at (" + r.centerX + ", " + r.centerY + ")");
            r.scale(6, 2);
            Console.WriteLine("The height of the rectangle is " + r.xLength + " and the width is " + r.yLength + " at (" + r.centerX + ", " + r.centerY + ")");
            r.move(2, 2);
            Console.WriteLine("The height of the rectangle is " + r.xLength + " and the width is " + r.yLength + " at (" + r.centerX + ", " + r.centerY + ")\n");

            Console.WriteLine("The height of the square is " + s.xLength + " and the width is " + s.yLength + " at (" + s.centerX + ", " + s.centerY + ")");
            s.scale(6, 2);
            Console.WriteLine("The height of the square is " + s.xLength + " and the width is " + s.yLength + " at (" + s.centerX + ", " + s.centerY + ")");
            s.move(2, 2);
            Console.WriteLine("The height of the square is " + s.xLength + " and the width is " + s.yLength + " at (" + s.centerX + ", " + s.centerY + ")\n");

            Console.WriteLine("The radius of the circle is " + c.radius + " at (" + c.centerX + ", " + c.centerY + ")");
            c.scale(6);
            Console.WriteLine("The radius of the circle is " + c.radius + " at (" + c.centerX + ", " + c.centerY + ")");
            c.move(2, 2);
            Console.WriteLine("The radius of the circle is " + c.radius + " at (" + c.centerX + ", " + c.centerY + ")");

            // Wait for user input to close the console
            Console.WriteLine("Press ENTER to close the window");
            Console.ReadLine();
        }