예제 #1
0
    public static void Main()
    {
        var size = int.Parse(Console.ReadLine());
        var romb = new Romb(size);

        Console.WriteLine(romb.DrawRomb().ToString());
    }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Laba_5, Yarokhmedov D., V-14\n");
            double[,] c = new double[2, 4];
            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    c[i, j] = i + j;
                }
            }
            Romb r = new Romb(c);

            r.Show();
            Console.WriteLine("Периметр - {0}", r.Periment());
            Console.WriteLine("Площадь - {0}", r.ploshad());
        }
예제 #3
0
//        Задание 1.
//Разработать абстрактный класс «Геометрическая Фигура» с методами «Площадь Фигуры» и «Периметр Фигуры».
//Разработать классы-наследники: Треугольник, Квадрат,
//Ромб, Прямоугольник, Параллелограмм, Трапеция, Круг,
//Эллипс.Реализовать конструкторы, которые однозначно
//определяют объекты данных классов.
//Реализовать класс «Составная Фигура», который
//может состоять из любого количества «Геометрических
//Фигур». Для данного класса определить метод нахождения
//площади фигуры.Создать диаграмму взаимоотношений
//классов.
        static void Main()
        {
            SostavnaFigura sf  = new SostavnaFigura();
            Elips          el1 = new Elips(3, 5);
            Krug           el2 = new Krug(3);
            Trapecia       el3 = new Trapecia(3, 5, 2, 2, 3);
            Priamokutnyk   el4 = new Priamokutnyk(3, 5);
            Romb           el5 = new Romb(3, 5);
            Kvadrat        el6 = new Kvadrat(3);
            Trykutnyk      el7 = new Trykutnyk(3, 5, 7);

            sf.AddFigura(el1);
            sf.AddFigura(el2);
            sf.AddFigura(el3);
            sf.AddFigura(el4);
            sf.AddFigura(el5);
            sf.AddFigura(el6);
            sf.AddFigura(el7);


            Console.WriteLine(sf.GetS());
        }
예제 #4
0
        static void Main(string[] args)
        {
            Romb R2 = new Romb();

            double[,] crdsR2 = { { 0.0, 4.0 }, { -2.0, 0.0 }, { 0.0, -4.0 }, { 2.0, 0.0 } };
            double[][] coordsR2 = new double[4][];
            for (int i = 0; i < 4; i++)
            {
                coordsR2[i] = new double[2];
                for (int j = 0; j < 2; j++)
                {
                    coordsR2[i][j] = crdsR2[i, j];
                }
            }
            Romb R3 = new Romb(coordsR2);

            Console.WriteLine("Coords of R2:");
            R2.WriteToConsole();
            Console.WriteLine();
            Console.WriteLine("Coords of R3:");
            R3.WriteToConsole();
            Console.WriteLine();
            Console.WriteLine();

            R3 = R3 * 2;

            Romb R1 = new Romb(R3 - R2);

            Console.WriteLine("Coords of R1:");
            R1.WriteToConsole();
            Console.WriteLine();
            Console.WriteLine("Perimeter of R1: {0}", Math.Round(R1.Perimeter, 2));
            Console.WriteLine("Square of R1: {0}", Math.Round(R1.Square, 2));
            double[] Angles = R1.GetAngles();
            Console.WriteLine("Angles of R1: {0, -7} {1, -7}", Math.Round(Angles[0], 2), Math.Round(Angles[1], 2));
            Console.WriteLine("Side of R1: {0}", Math.Round(R1.Side, 2));
            Console.ReadKey();
        }