static void Main()
        {
            double rh, rw, ss, cr;

            Console.WriteLine("Введите высоту прямоугольника : ");
            rh = Double.Parse(Console.ReadLine());
            Console.WriteLine("Введите ширину прямоугольника : ");
            rw = Double.Parse(Console.ReadLine());
            Rectangle rect = new Rectangle(rh, rw);

            rect.Print();

            Console.WriteLine("Введите сторону квадрата : ");
            ss = Double.Parse(Console.ReadLine());
            Square sq = new Square(ss);

            sq.Print();

            Console.WriteLine("Введите радиус окружности : ");
            cr = Double.Parse(Console.ReadLine());
            Circle cir = new Circle(cr);

            cir.Print();


            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Rectangle rect   = new Rectangle(5, 4);
            Quadrate  square = new Quadrate(5);
            Circle    circle = new Circle(5);

            rect.Print();
            square.Print();
            circle.Print();
            Console.ReadLine();
        }
Esempio n. 3
0
        static void Main()
        {
            Rect   rect   = new Rect(5, 4);
            Square square = new Square(5);
            Circle circle = new Circle(5);

            rect.Print();
            square.Print();
            circle.Print();
            rect = square;
            rect.Print();
        }
        static void Main(string[] args)
        {
            var rect = new Rectangle(8, 9);
            var squ  = new Square(22);
            var crcl = new Circle(4);

            rect.Print();
            squ.Print();
            crcl.Print();
            Console.WriteLine();
            PrintF(crcl);
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Rectangle obj = new Rectangle(1, 5);

            obj.Print();
            Circle obj1 = new Circle(2);

            obj1.Print();
            Square obj2 = new Square(3);

            obj2.Print();
            Console.Read();
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("Ширшов А.С ИУ5-35Б");
            Console.ResetColor();
            Rectangle Pryamougolnik = new Rectangle(2, 4);
            var       Krug          = new Circle(4);
            var       Kvadrat       = new Square(5);

            Pryamougolnik.Print();
            Kvadrat.Print();
            Krug.Print();
            Console.ReadKey();
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            Rectangle a = new Rectangle(2, 4);

            a.Print();

            Square b = new Square(5);

            b.Print();

            Circle c = new Circle(10);

            c.Print();
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Лабораторная работа 2 - 'Нахождение площадей фигур'");
            Console.Title = "Выполнил:Ли М.В. Группа:ИУ5-34Б";
            Console.ResetColor();
            Rectangle rect;
            Circle    circ;
            Square    squar;
            double    a1, b1;

            do
            {
                switch (Menu())
                {
                case 1:
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    a1   = Continue("Введите значение длины прямоугольника: ");
                    b1   = Continue("Введите значение ширины прямоугольника: ");
                    rect = new Rectangle(a1, b1);
                    rect.Print();
                    Console.ResetColor();
                    break;

                case 2:
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    a1    = Continue("Введите значение стороны квадрата:");
                    squar = new Square(a1);
                    squar.Print();
                    Console.ResetColor();
                    break;

                case 3:
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    a1   = Continue("Введите значение радиуса окружности: ");
                    circ = new Circle(a1);
                    circ.Print();
                    Console.ResetColor();
                    break;

                case 4:
                    Environment.Exit(0);
                    Console.ReadKey();
                    break;

                default:
                    break;
                }
            } while (AskContinue());
        }
Esempio n. 9
0
        static void Main(string[] args)
        {
            Console.Title = "Мирсонов Вячеслав РТ5-31Б";
            Rectangle obj1 = new Rectangle(10, 20);  //создание объекта класса Прямокгольник и параметров в конструктор
            Square    obj2 = new Square(15);         //создание объекта класса Квадрат и передача параметра в конструктор
            Circle    obj3 = new Circle(20);         //создание объекта класса Круг и передача параметра в конструктор

            Console.ForegroundColor = ConsoleColor.Green;
            obj1.Print();            //вызов метода печати данных об объекте класса Прямоугольник
            obj2.Print();            //вызов метода печати данных об объекте класса Квадрат
            obj3.Print();            //вызов метода печати данных об объекте класса Окружность
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.ReadLine();
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            GeoFigure fig;
            int i;
            string buf;
            Double a = 0, b = 0;

            Console.Title = "Алпеев Владислав ИУ5-34Б";
            Console.Write("Какую фигуру вы ходите создать? \n1 - Прямоугольник.\n2 - Квадрат.\n3 - Круг.\nВведите номер фигуры: ");

            while (!int.TryParse(buf = Console.ReadLine(), out i))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("Номер введен неправильно. Введите номер повторно: ");
                Console.ForegroundColor = ConsoleColor.White;
            }
            i = int.Parse(buf);


            switch (i)
            {
                case 1:
                    Console.Write("Введите высоту фигуры: ");
                    a = Double.Parse(Console.ReadLine());
                    Console.Write("Введите ширину фигуры: ");
                    b = Double.Parse(Console.ReadLine());
                    fig = new Rectangle(a, b);
                    break;
                case 2:
                    Console.Write("Введите высоту фигуры: ");
                    a = Double.Parse(Console.ReadLine());
                    fig = new Square(a); break;
                case 3:
                    Console.Write("Введите радиус фигуры: ");
                    a = Double.Parse(Console.ReadLine());
                    fig = new Circle(a); break;
                default: fig = new Rectangle(0, 0); break;
            }
            Console.WriteLine(fig.ToString() + "\n");

            Rectangle fig1 = new Rectangle(2, 3);
            fig1.Print();
            Square fig2 = new Square(2);
            fig2.Print();
            Circle fig3 = new Circle(2);
            fig3.Print();
            Console.ReadKey();
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            Rectangle rectangle1 = new Rectangle(5, 5);

            rectangle1.Print();

            Square square1 = new Square(5);

            square1.Print();

            Circle circle1 = new Circle(5);

            circle1.Print();

            Console.ReadLine();
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            Console.Title = "Назаров Максим Михайлович Группа ИУ5-33Б";
            Rectangle rect = new Rectangle();
            Square    sq   = new Square();
            Circle    cir  = new Circle();

            rect.property_shirina = 6;
            rect.property_visota  = 3;
            sq.property_shirina   = 6;
            sq.property_visota    = 6;
            cir.property_radius   = 5;
            rect.Print();
            sq.Print();
            cir.Print();
            Console.ReadKey();
        }
Esempio n. 13
0
        static void Main(string[] args)
        {
            Console.Title = "Сахарова Елизавета ИУ5-32Б";
            Rectangle _rectangle = new Rectangle(3, 5);

            _rectangle.Print();

            Square _square = new Square(4);

            _square.Print();

            Circle _circle = new Circle(2.0);

            _circle.Print();

            Console.ReadLine();
        }
Esempio n. 14
0
        static void Main(string[] blahBlah)
        {
            Console.WriteLine("Введите параметры фигур \n");
            double inn1, inn2;

            inn1 = Convert.ToDouble(Console.ReadLine());
            inn2 = Convert.ToDouble(Console.ReadLine());
            Rectangle rec = new Rectangle(inn1, inn2);
            Square    sc  = new Square(inn2);
            Circle    cir = new Circle(inn2);

            rec.Print();
            sc.Print();
            cir.Print();


            Console.ReadKey();
        }
Esempio n. 15
0
        static void Main(string[] args)
        {
            Console.WriteLine("Выберите фигуру для которой хотите найти площадь");
            Console.WriteLine(" 1 - Круг");
            Console.WriteLine(" 2 - Прямоугольник");
            Console.WriteLine(" 3 - Квадрат");

            int n = Convert.ToInt32(Console.ReadLine());

            switch (n)
            {
            case 1:
                Console.WriteLine("Введите радиус круга:");
                int    F1     = Convert.ToInt32(Console.ReadLine());
                Circle circle = new Circle(F1);
                circle.Print();
                Console.ReadKey();
                break;

            case 2:
                Console.WriteLine("Введите длину прямоугольника:");
                int F3 = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Введите высоту прямоугольника:");
                int  F2        = Convert.ToInt32(Console.ReadLine());
                Rect rectangle = new Rect(F3, F2);
                rectangle.Print();
                Console.ReadKey();
                break;

            case 3:
                Console.WriteLine("Введите длину стороны квадрата:");
                int  F4     = Convert.ToInt32(Console.ReadLine());
                Rect square = new Rect(F4);
                square.Print();
                Console.ReadKey();
                break;

            default:
                Console.WriteLine("Ошибка!");
                Console.ReadKey();
                break;
            }
        }
Esempio n. 16
0
        static void Main(string[] args)
        {
            Console.WriteLine("Выберите фигуру длякоторой  вы хотите посчитать площадь");
            Console.WriteLine("Нажмите 1 === Прямоугольник");
            Console.WriteLine("Нажмите 2 === Квадрат");
            Console.WriteLine("Нажмите 3 === Круг");
            int n = Convert.ToInt32(Console.ReadLine());

            if (n == 1)
            {
                Console.WriteLine("Введите длину прямоугольника:");
                int b = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("ведите ширину прямоугольника:");
                int       c         = Convert.ToInt32(Console.ReadLine());
                Rectangle rectangle = new Rectangle(b, c);
                rectangle.Print();
                Console.ReadKey();
            }
            else if (n == 2)
            {
                Console.WriteLine("Введите сторону квадрата:");
                int       d      = Convert.ToInt32(Console.ReadLine());
                Rectangle square = new Rectangle(d);
                square.Print();
                Console.ReadKey();
            }
            else if (n == 3)
            {
                Console.WriteLine("Введите радиус окружности:");
                int    a      = Convert.ToInt32(Console.ReadLine());
                Circle circle = new Circle(a);
                circle.Print();
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Ошибка! Неверное число");
                Console.ReadKey();
            }
        }
Esempio n. 17
0
        public static void Main(string[] args)
        {
            double a, b;

            a = AskNumber("Введите ширину прямоугольника: ");
            b = AskNumber("Введите высоту прямоугольника: ");
            Rect rect = new Rect(a, b);

            rect.Print();
            Console.WriteLine();

            a = AskNumber("Введите сторону квадрата: ");
            Quadr quadr = new Quadr(a);

            quadr.Print();
            Console.WriteLine();

            a = AskNumber("Введите радиус круга: ");
            Circle circle = new Circle(a);

            circle.Print();
        }
Esempio n. 18
0
        static void Main(string[] args)
        {
            IPrint obj;
            bool   exitFlag = false;
            double a1, b1;

            Console.Title = "Кобяк Андрей ИУ5-32Б";
            do
            {
                switch (Menu())
                {
                case STATE.Rectangle:
                    a1  = InputVal("Введите высоту прямоугольника \n");
                    b1  = InputVal("Введите ширину прямоугольника \n");
                    obj = new Rectangle(a1, b1);
                    obj.Print();
                    break;

                case STATE.Sqare:
                    a1  = InputVal("Введите сторону квадрата \n");
                    obj = new Square(a1);
                    obj.Print();
                    break;

                case STATE.Circle:
                    a1  = InputVal("Введите радиус окружности \n");
                    obj = new Circle(a1);
                    obj.Print();
                    break;

                default:
                    exitFlag = true;
                    break;
                }
                ClearScreen();
            } while (!exitFlag);
        }
Esempio n. 19
0
        static void Main(string[] args)
        {
            //-----------------------------------------------------------------------------------------------------------------
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------");
            Rectangle rect   = new Rectangle(5, 4);
            Rectangle square = new Rectangle(5);
            Circle    circle = new Circle(5);

            rect.Print();
            square.Print();
            circle.Print();
            Console.ReadLine();
            //-----------------------------------------------------------------------------------------------------------------
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------");
            //Создание коллекции класса ArrayList
            ArrayList al = new ArrayList();

            //Добавление объектов в коллекцию
            al.Add(333);
            al.Add(123.123);
            al.Add("строка");
            al.Add(11);
            al.Add("q");
            al.Add(1456);
            al.Add(0.5);
            //Сортировка по типу данных
            foreach (object o in al)
            {
                string type = o.GetType().Name;
                if (type == "Int32")
                {
                    Console.WriteLine("Целое число: " + o.ToString());
                }
                else if (type == "String")
                {
                    Console.WriteLine("Строка: " + o.ToString());
                }
                else
                {
                    Console.WriteLine("Другой тип: " + o.ToString());
                }
            }

            Console.ReadLine();
            //-----------------------------------------------------------------------------------------------------------------
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------");
            //Создание коллекции класса List<Figure>
            List <Figure> li = new List <Figure>();

            //Добавление объектов в коллекцию
            li.Add(rect);
            li.Add(square);
            li.Add(circle);
            //Сортировка по площади фигуры
            var orderedNumbers = from i in li
                                 orderby i.Area()
                                 select i;

            foreach (Figure i in orderedNumbers)
            {
                Console.WriteLine(i);
            }
            //-----------------------------------------------------------------------------------------------------------------
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("\nМатрица");
            Matrix <Figure> matrix = new Matrix <Figure>(3, 3, 3, new FigureMatrixCheckEmpty());

            matrix[0, 0, 0] = rect;
            matrix[1, 1, 1] = square;
            matrix[2, 2, 2] = circle;
            Console.WriteLine(matrix.ToString());
            Console.ReadLine();
            //-----------------------------------------------------------------------------------------------------------------
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------");
            SimpleStack <Figure> stack = new SimpleStack <Figure>();

            //добавление данных в стек
            stack.Push(rect);
            stack.Push(square);
            stack.Push(circle);
            //чтение данных из стека
            while (stack.Count > 0)
            {
                Figure f = stack.Pop();
                Console.WriteLine(f);
            }
            Console.ReadLine();
        }
Esempio n. 20
0
        static void Main(string[] args)
        {
            Circle a = new Circle(4.5);

            a.Print();
        }
Esempio n. 21
0
        static int Main(string[] args)
        {
            int n = 0;

            while (n != 4)
            {
                Main_menu();
                n = int.Parse(Console.ReadLine());
                switch (n)
                {
                case 1:
                {
                    double    len;
                    Rectangle rect = new Rectangle(0, 0);
                    Console.WriteLine("Введите значения");
                    Console.Write("Ширина ");
                    len = Double.Parse(Console.ReadLine());

                    rect.length1 = len;

                    Console.Write("Длина ");
                    len = Double.Parse(Console.ReadLine());

                    rect.length2 = len;
                    rect.finding_area();

                    rect.Print();

                    break;
                }

                case 2:
                {
                    double len;
                    Square scv = new Square(0);
                    Console.WriteLine("Введите значение");
                    Console.Write("Сторона ");
                    len         = Double.Parse(Console.ReadLine());
                    scv.length1 = len;
                    scv.length2 = len;

                    scv.finding_area();

                    scv.Print();

                    break;
                }

                case 3:
                {
                    double len;
                    Circle cir = new Circle(0);
                    Console.WriteLine("Введите значение");
                    Console.Write("Радиус ");
                    len        = Double.Parse(Console.ReadLine());
                    cir.radius = len;

                    cir.finding_area();

                    cir.Print();

                    break;
                }

                case 4:
                {
                    Console.WriteLine("Нажмите, чтобы продолжить");
                    Console.ReadKey();
                    break;
                }

                default:
                {
                    Console.WriteLine("Ошибка");
                }
                break;
                }
            }
            return(0);
        }
Esempio n. 22
0
        static int Main(string[] args)
        {
            int n = 0;

            while (n != 4)
            {
                Main_menu();
                n = int.Parse(Console.ReadLine());
                switch (n)
                {
                case 1:
                {
                    double    len;
                    Rectangle rect = new Rectangle(0, 0);
                    Console.WriteLine("Please put in your value");
                    Console.Write("Length 1 ");
                    len = Double.Parse(Console.ReadLine());

                    rect.length1 = len;

                    Console.Write("Length 2 ");
                    len = Double.Parse(Console.ReadLine());

                    rect.length2 = len;
                    rect.finding_area();

                    rect.Print();

                    break;
                }

                case 2:
                {
                    double len;
                    Square scv = new Square(0);
                    Console.WriteLine("Please put in your value");
                    Console.Write("Length ");
                    len         = Double.Parse(Console.ReadLine());
                    scv.length1 = len;
                    scv.length2 = len;

                    scv.finding_area();

                    scv.Print();

                    break;
                }

                case 3:
                {
                    double len;
                    Circle cir = new Circle(0);
                    Console.WriteLine("Please put in your value");
                    Console.Write("Radius ");
                    len        = Double.Parse(Console.ReadLine());
                    cir.radius = len;

                    cir.finding_area();

                    cir.Print();

                    break;
                }

                case 4:
                {
                    Console.WriteLine("Exiting.\n");
                    Console.ReadKey();
                    break;
                }

                default:
                {
                    Console.WriteLine("ERROR");
                }
                break;
                }
            }
            return(0);
        }
Esempio n. 23
0
        static int Main(string[] args)
        {
            double a = 0, b = 0;

            while (true)
            {
                switch (menu())
                {
                case 1:
                {
                    Console.WriteLine("Enter width: ");
                    a = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter height: ");
                    b = int.Parse(Console.ReadLine());
                    check(a);
                    check(b);
                    if (check(a) == false || check(b) == false)
                    {
                        Console.WriteLine("Sides can't be negative");
                        break;
                    }
                    Rectangle rect = new Rectangle(a, b);
                    rect.Print();
                    break;
                }

                case 2:
                {
                    Console.WriteLine("Enter size of the side: ");
                    a = int.Parse(Console.ReadLine());
                    check(a);
                    if (check(a) == false)
                    {
                        Console.WriteLine("Sides can't be negative");
                        break;
                    }
                    Square sq = new Square(a);
                    sq.Print();
                    break;
                }

                case 3:
                {
                    Console.WriteLine("Enter radius: ");
                    a = int.Parse(Console.ReadLine());
                    check(a);
                    if (check(a) == false)
                    {
                        Console.WriteLine("Radius can't be negative");
                        break;
                    }
                    Circle circ = new Circle(a);
                    circ.Print();
                    break;
                }

                default:
                {
                    Console.WriteLine("Enter number from 1 to 4");
                    break;
                }

                case 4:
                {
                    return(0);
                }
                }
                Console.ReadLine();
                Console.Clear();
            }
        }