示例#1
0
        static void Main(string[] args)
        {
            var quad1     = new Quad(3, 4, 5, 6);
            var perimeter = quad1.GetPerimeter();

            Console.WriteLine($"quad1's perimeter is {perimeter}.\n");

            var quad2 = new Quad();

            Console.WriteLine($"quad2's perimeter is {quad2.GetPerimeter()}.\n");

            var rect1 = new Rect(4, 6);

            Console.WriteLine($"rect1's perimeter is {rect1.GetPerimeter()}, \nrect1's      area is {rect1.GetArea()}.\n");


            var rect2 = new Rect(5, 8);

            Console.WriteLine($"rect2's perimeter is {rect2.GetPerimeter()}, \nrect2's      area is {rect2.GetArea()}.\n");

            var sqr1 = new Sqr(5);

            Console.WriteLine($"sqr1's perimeter is {sqr1.GetPerimeter()}, \nsqr1's      area is {sqr1.GetArea()}.\n");

            var sqr2 = new Sqr(7);

            Console.WriteLine($"sqr2's perimeter is {sqr2.GetPerimeter()}, \nsqr2's      area is {sqr2.GetArea()}.\n");
        }
示例#2
0
        static void Main(string[] args)
        {
            var sqr1 = new Sqr(5);

            Console.WriteLine($"sqr1 perimeter is {sqr1.Perimeter()}, area is {sqr1.Area()}");
            Console.WriteLine($"sqr1 is a {sqr1.Print()}");

            var rect1 = new Rect(6, 4);

            Console.WriteLine($"rect1 perimeter is {rect1.Perimeter()}, area is {rect1.Area()}");
            var rect2 = new Rect(5, 8);

            Console.WriteLine($"rect2 perimeter is {rect2.Perimeter()}, area is {rect2.Area()}");

            var quad1     = new Quad(3, 4, 5, 6);
            var perimeter = quad1.Perimeter();

            Console.WriteLine($"quad1's perimeter is {perimeter}");
            var quad2 = new Quad();

            Console.WriteLine($"quad2's perimeter is {quad2.Perimeter()}");
        }
        static void Main(string[] args)
        {
            var sqr3 = new Sqr3(7);

            Console.WriteLine($"The perimeter of the square is {sqr3.Perimeter()} and the area is {sqr3.Area()}");


            var rect3 = new Rect3(5, 2);

            Console.WriteLine($"The perimeter of the square is {rect3.Perimeter()}");

            var x = 0;


            var sqr1  = new Sqr(9);
            var rect1 = new Rect(7, 2);
            var quad1 = new Quad(4, 6, 1, 3);

            Console.WriteLine($"The perimeter of the square is {sqr1.Perimeter()} and the area is {sqr1.Area()}");
            Console.WriteLine($"The perimeter of the rectangle is {rect1.Perimeter()} and the area is {rect1.Area()}");
            Console.WriteLine($"The perimeter of the quadrilater is {quad1.Perimeter()}");
            var sqr2  = new Sqr2(5);
            var rect2 = new Rect2(6, 3);
        }