Beispiel #1
0
        static void Main(string[] args)
        {
            //Task 1
            String first = new String("this is a regular string");

            Console.WriteLine(first.Sentence);
            Console.WriteLine(first.GetLength());


            SymbolString second = new SymbolString("this is a symbol string");

            Console.WriteLine(second.Sentence);
            second.Sort();
            Console.WriteLine(second.Sentence);
            Console.WriteLine(second.GetLength());

            //Task 2
            Rhombus rhombus = new Rhombus(new float[, ] {
                { 0, 0 }, { 2, 0 }, { 3, 2 }, { 1, 2 }
            });

            Console.WriteLine(rhombus.GetPerimeter());
            Console.WriteLine(rhombus.GetArea());

            Circle circle = new Circle(3);

            Console.WriteLine(circle.GetArea());
            Console.WriteLine(circle.GetPerimeter());
        }
Beispiel #2
0
        private void Init()
        {
            EnumFiguresColors.ListFigures figures;
            for (int i = 0; i < NumbersFiguresList.LongCount(); i++)
            {
                figures = (EnumFiguresColors.ListFigures)Enum.GetValues(typeof(EnumFiguresColors.ListFigures)).GetValue(NumbersFiguresList[i]);
                switch (figures)
                {
                case EnumFiguresColors.ListFigures.triangle:
                    Point[] arrTrg = new Point[3] {
                        new Point(0, 0), new Point(2, 3), new Point(3, -4)
                    };
                    _arrayFigures[i] = new Triangle(arrTrg);
                    break;

                case EnumFiguresColors.ListFigures.parallelogram:
                    Point[] arrPar = new Point[4] {
                        new Point(0, 0), new Point(3, 2), new Point(6, 2), new Point(3, 0)
                    };
                    _arrayFigures[i] = new Parallelogram(arrPar);
                    break;

                case EnumFiguresColors.ListFigures.trapezium:
                    Point[] arrTrz = new Point[4] {
                        new Point(0, 0), new Point(3, 2), new Point(6, 2), new Point(7, 0)
                    };
                    _arrayFigures[i] = new Trapezium(arrTrz);
                    break;

                case EnumFiguresColors.ListFigures.rhombus:
                    Point[] arrRmb = new Point[4] {
                        new Point(-3, 0), new Point(0, 3), new Point(3, 0), new Point(0, -3)
                    };
                    _arrayFigures[i] = new Rhombus(arrRmb);
                    break;

                case EnumFiguresColors.ListFigures.polygon:
                    _arrayFigures[i] = new Polygon();
                    break;
                }
            }
        }