예제 #1
0
파일: Program.cs 프로젝트: marcchik/lab
        static void Main(string[] args)
        {
            Train tr1 = new Train("голубой", 540, 1000);
            Train tr2 = new Train("зеленый", 80, 900);
            Train tr3 = new Train("желтый", 14, 400);



            Print.IamPrinting(tr3);
            tr1.ShowTrain(tr1.n, tr1.color, tr1.price);
            tr2.ShowTrain(tr2.n, tr2.color, tr3.price);
            tr3.ShowTrain(tr3.n, tr3.color, tr3.price);

            Car car1 = new Car("BMW", 5283, 5000, 6, 220);
            Car car2 = new Car("Lada", 8603, 4000, 5, 160);
            Car car3 = new Car("Audi", 1110, 9800, 4, 120);
            Car car4 = new Car("BMW", 5683, 5600, 6, 240);
            Car car5 = new Car("Lada", 5603, 4800, 5, 300);
            Car car6 = new Car("Audi", 3110, 9100, 7, 180);

            car1.ShowCar(car1.mark, car1.number, car1.price, car1.dt, car1.speed);
            car2.ShowCar(car2.mark, car2.number, car2.price, car2.dt, car2.speed);
            car3.ShowCar(car3.mark, car3.number, car3.price, car3.dt, car3.speed);
            car4.ShowCar(car4.mark, car4.number, car4.price, car4.dt, car4.speed);
            car5.ShowCar(car5.mark, car5.number, car5.price, car5.dt, car5.speed);
            car6.ShowCar(car6.mark, car6.number, car6.price, car6.dt, car6.speed);

            if (car1 is Train)
            {
                Console.WriteLine("Ложь!");
            }
            else
            {
                Console.WriteLine("Машина - не поезд!");
            }

            int count = 0;

            object[] ListOfVehicle = new object[6];
            ListOfVehicle[0] = car1;
            ListOfVehicle[1] = car2;
            ListOfVehicle[2] = car3;
            ListOfVehicle[3] = car4;
            ListOfVehicle[4] = car5;
            ListOfVehicle[5] = car6;


            Console.WriteLine();
            Console.WriteLine("Машины с расходом топлива больше 5 литров на 100 км.");
            Console.WriteLine();

            foreach (Car ts in ListOfVehicle)
            {
                count++;
                if (ts.dt > 5)
                {
                    Console.WriteLine(count + ")" + ts.mark + " " + ts.number);
                }
            }
            Console.WriteLine();
            Console.Write("Введите желаемую скорость: ");
            int max = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Машины с заданной максимальной скоростью.");
            Console.WriteLine();
            count = 0;
            foreach (Car ts in ListOfVehicle)
            {
                count++;
                if (ts.speed > max)
                {
                    Console.WriteLine(count + ")" + ts.mark + " " + ts.number + " max скорость:" + ts.speed);
                }
            }
            Console.WriteLine();
            Agent ag1 = new Agent();

            ag1.Add();
            ag1.Show();
            Console.ReadKey();
        }