예제 #1
0
        static public void ChooseAdd(List <Car> garage, VolvoXC70 volvo, Car car, VolkswagenGolf golf, ChevroletMalibu chevrolet)
        {
            Console.WriteLine("What vehicle do you want to add : \n1 - Car\n2 - VolvoXC70\n3 - Volkswagen Golf\n4 - ChevroletMalibu\n5 - Exit ");
            switch (Console.ReadKey(false).Key)
            {
            case ConsoleKey.D1: Console.Clear(); garage.Add(AddNewCar(1)); Console.Clear(); break;

            case ConsoleKey.D2: Console.Clear(); garage.Add(AddNewCar(2)); Console.Clear(); break;

            case ConsoleKey.D3: Console.Clear(); garage.Add(AddNewCar(3)); Console.Clear(); break;

            case ConsoleKey.D4: Console.Clear(); garage.Add(AddNewCar(4)); Console.Clear(); break;

            case ConsoleKey.D5: return;
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            List <Car>  garage = new List <Car>();
            List <Bike> camp   = new List <Bike>();

            Car             car       = new Car();
            VolkswagenGolf  golf      = new VolkswagenGolf(100, true, "blue", 10);
            VolvoXC70       volvo     = new VolvoXC70(50, true, "white", 100);
            ChevroletMalibu chevrolet = new ChevroletMalibu(0, false, "Orange", 20);
            VolkswagenPolo  polo      = new VolkswagenPolo(2, "yellow");
            Bike            bike      = new Bike(15, 2, "black", false, 0);

            garage.Add(car);
            garage.Add(volvo);
            garage.Add(chevrolet);
            garage.Add(golf);
            garage.Add(polo);
            camp.Add(bike);

            int index;

            do
            {
                Console.WriteLine("Your garage : \n1 - Add\n2 - Info about my vehicles\n3 - Throw Vehicle Away\n4 - Test Drive\n5 - Repair\n6 - Fill Fuel" +
                                  "\n7 - Go to Bike camp\n8 - Exit");
                switch (Console.ReadKey(false).Key)
                {
                case ConsoleKey.D1: Console.Clear(); ChooseAdd(garage); Console.Clear(); break;

                case ConsoleKey.D2: Console.Clear(); FuelSort(garage); AllVehicleInfo(garage); Console.ReadKey(); Console.Clear(); break;

                case ConsoleKey.D3: Console.Clear(); CarChoice(garage, out index); garage.Remove(garage[index]); Console.Clear(); break;

                case ConsoleKey.D4: Console.Clear(); CarChoice(garage, out index); garage[index].Ride(); Console.Clear(); break;

                case ConsoleKey.D5: Console.Clear(); CarChoice(garage, out index); garage[index].Repair(); Console.Clear(); break;

                case ConsoleKey.D6: Console.Clear(); CarChoice(garage, out index); garage[index].FillFuel(); Console.Clear(); break;

                case ConsoleKey.D7: Console.Clear(); BikeCamp(camp); Console.Clear(); break;

                case ConsoleKey.D8: return;

                default: Console.Clear(); break;
                }
            } while (true);
        }
예제 #3
0
        static void Main(string[] args)
        {
            List <Car>      garage    = new List <Car>();
            Car             car       = new Car();
            VolkswagenGolf  golf      = new VolkswagenGolf(100, true, "blue", 10);
            VolvoXC70       volvo     = new VolvoXC70(50, true, "white", 100);
            ChevroletMalibu chevrolet = new ChevroletMalibu(0, false, "Orange", 20);

            garage.Add(car);
            garage.Add(golf);
            garage.Add(volvo);
            garage.Add(chevrolet);

            int index;

            do
            {
                Console.WriteLine("Your garage : \n1 - Add\n2 - Info about my vehicles\n3 - Throw Vehicle Away\n4 - Test Drive\n5 - Repair\n6 - Fill Fuel\n7 - Exit");
                switch (Console.ReadKey(false).Key)
                {
                case ConsoleKey.D1: Console.Clear(); ChooseAdd(garage, volvo, car, golf, chevrolet); Console.Clear(); break;

                case ConsoleKey.D2: Console.Clear(); AllVehicleInfo(garage); Console.ReadKey(); Console.Clear(); break;

                case ConsoleKey.D3: Console.Clear(); CarChoice(garage, out index); garage.Remove(garage[index]); Console.Clear(); break;

                case ConsoleKey.D4: Console.Clear(); CarChoice(garage, out index); garage[index].Ride(); Console.Clear(); break;

                case ConsoleKey.D5: Console.Clear(); CarChoice(garage, out index); garage[index].Repair(); Console.Clear(); break;

                case ConsoleKey.D6: Console.Clear(); CarChoice(garage, out index); garage[index].FillFuel(); Console.Clear(); break;

                case ConsoleKey.D7: return;

                default: Console.Clear(); break;
                }
            } while (true);
        }