Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Triangle ABC = new Triangle(0, 10, 7, 10, 0, 0);

            ABC.Print();

            SquareFigure ABCD = new SquareFigure(10);

            ABCD.Print();

            Rhombus rhombus = new Rhombus(12, 6);

            rhombus.Print();

            Rectangle rectangle = new Rectangle(12, 6);

            rectangle.Print();


            Geometric_figure[] gfArr = new Geometric_figure[4]
            {
                ABC,
                ABCD,
                rhombus,
                rectangle,
            };

            SostavnFigura sf = new SostavnFigura(gfArr);

            sf.Print();


            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Figure figure = new Triangle(5, 7, 4);

            figure.Print();
            Console.WriteLine($"Периметр: {figure.Perimeter()} ");
            Console.WriteLine($"Площадь: {figure.Square()} ");

            Figure figure2 = new Squared(5, 5);

            figure2.Print();
            Console.WriteLine($"Периметр: {figure2.Perimeter()} ");
            Console.WriteLine($"Площадь: {figure2.Square()} ");

            Figure figure3 = new Rhombus(5, 5, 8);

            figure3.Print();
            Console.WriteLine($"Периметр: {figure3.Perimeter()} ");
            Console.WriteLine($"Площадь: {figure3.Square()} ");

            Figure figure4 = new Rectangle(5, 6);

            figure4.Print();
            Console.WriteLine($"Периметр: {figure4.Perimeter()} ");
            Console.WriteLine($"Площадь: {figure4.Square()} ");

            Figure figure5 = new Circle(5, 5, 10);

            figure5.Print();
            Console.WriteLine($"Периметр: {figure5.Perimeter()} ");
            Console.WriteLine($"Площадь: {figure5.Square()} ");
            Console.WriteLine("=============================");


            Compound f = new Compound();

            f.AddFigure(figure2);
            f.AddFigure(figure3);
            f.AddFigure(figure4);
            f.PrintgeneralSquare();


            Console.ReadKey();
        }