Example #1
0
        static void Main(string[] args)
        {
            IVehicle car   = Car.Create();
            IVehicle truck = Truck.Create();
            IVehicle bus   = Bus.Create();
            int      N     = int.Parse(Console.ReadLine());

            for (int i = 1; i <= N; i++)
            {
                try
                {
                    DoCommands(car, truck, bus);
                }
                catch (ArgumentException ae)
                {
                    Console.WriteLine(ae.Message);
                    continue;
                }
            }
            car.Print();
            truck.Print();
            bus.Print();
            Console.ReadLine();
        }