示例#1
0
        static void Main(string[] args)
        {
            var figuras = new IGeometricShape[] {
                new Rectangle {
                    Width = 10, Height = 5
                },
                new EquilateralTriangle {
                    SideLength = 10
                },
                new Square {
                    SideLength = 20
                },
                new Rectangle {
                    Width = 3, Height = 1
                },
                new Square {
                    SideLength = 32
                }
            };

            GreatCalculator calculator = new GreatCalculator();

            calculator.Calculate(figuras);

            Console.WriteLine("Suma de areas: " + calculator.TotalAreas);
            Console.WriteLine("Suma de perimetros: " + calculator.TotalPerimeters);

            Console.ReadKey();
        }
示例#2
0
文件: Program.cs 项目: iquiroga/SOLID
        static void Main(string[] args)
        {
            var figuras = new IGeometricShape[]
            {
                new Rectangle {
                    Width = 10, Height = 5
                },
                new EquilateralTriangle {
                    SideLength = 5
                },
                new Rectangle {
                    Width = 4, Height = 6
                },
                new Square {
                    SideLength = 10
                },
                new Rectangle {
                    Width = 5, Height = 1
                },
                new Square {
                    SideLength = 8
                },
                new EquilateralTriangle {
                    SideLength = 5
                }
            };

            var calculator = new GreatCalculator();

            calculator.Calculate(figuras);

            Console.WriteLine($"Area total: {calculator.TotalAreas}\nPerímetro total: {calculator.TotalPerimeters}");
            Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            var figuras = new IGeometricShape[]
            {
                new Square {
                    SideLength = 10
                },
                new EquilateralTriangle {
                    SideLength = 5
                }
            };
            var calculator = new GreatCalculator();

            calculator.Calculate(figuras);
            Console.WriteLine($"Area Total:{calculator.TotalAreas} ");
        }