예제 #1
0
        static public Vehicle AddNewVehicle()
        {
            Console.WriteLine("Type : ");
            string type = Console.ReadLine();

            Console.WriteLine("Color : ");
            string color = Console.ReadLine();

            Console.WriteLine("Wheels : ");
            int wheels;

            Assist.NumberCheck(Console.ReadLine(), out wheels);
            Console.WriteLine("Speed : ");
            int speed;

            Assist.NumberCheck(Console.ReadLine(), out speed);
            Console.WriteLine("Distance : ");
            int distance;

            Assist.NumberCheck(Console.ReadLine(), out distance);
            Console.WriteLine("Broken : ");
            string isBroken = (Console.ReadLine());
            bool   izBroken = Assist.DefineBool(isBroken);

            return(new Vehicle(type, speed, wheels, color, izBroken, distance));
        }
예제 #2
0
        static void VehicleChoice(List <Vehicle> garage, out int index)
        {
            int size = garage.Count();

            do
            {
                Console.WriteLine("Choose the vehicle by its id (from 0 to {0})", size);
                Assist.NumberCheck(Console.ReadLine(), out index);
            } while (index >= size);
        }