Пример #1
0
        static void Main(string[] args)
        {
            Garage garage = new Garage();

            garage.TitleScreen();

            bool flag = true;

            while (flag)
            {
                Console.Clear();
                garage.GarageScreen();
                Console.WriteLine("1.Choose a car to drive\n2.Refuel all cars\n3.Add a car\n4.Remove a car\n5.List all cars\n0.Exit");
                string input = Console.ReadLine();
                switch (input)
                {
                case "1":
                    garage.ListAllCars();
                    Console.WriteLine("Type ID to select car");
                    int id = Convert.ToInt32(Console.ReadLine());
                    SubMenu(garage.Select_Car(id));
                    break;

                case "2":
                    garage.FuelAllCars();
                    Console.WriteLine("All cars are fueled up and ready to go!");
                    Console.ReadKey();
                    break;

                case "3":
                    garage.AddNewCar("{0}", "{1}", 0, 100);
                    break;

                case "4":
                    garage.RemoveCar();
                    break;

                case "5":
                    garage.ListAllCars();
                    Console.ReadKey();
                    break;

                case "0":
                    flag = false;
                    break;

                default:
                    Console.WriteLine("Something went wrong.");
                    break;
                }
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Garage my = new Garage();

            my.AddCar("Ford", "Focus");
            my.AddCar("Chevy", "Silverado");
            my.AddCar("Audi", "R8");
            bool flag = true;

            Console.WriteLine("\t\t\t3 To create a car");
            Console.WriteLine("\t\t\t2 To print list of cars");
            Console.WriteLine("\t\t\t1 To select a car with ID");
            while (flag)
            {
                String input = Console.ReadLine();
                switch (input)
                {
                case "1":
                    Console.WriteLine("Type ID to select a car, press 2 to print all cars");
                    int index = Convert.ToInt32(Console.ReadLine());
                    Submenu(my.Select_Car(index));
                    break;

                case "2":

                    my.ListAllCars();
                    Console.WriteLine("\t\t\t1 To select a car with ID");
                    break;

                case "3":
                    Console.WriteLine("Please type Make and Model of your car");
                    string make  = Console.ReadLine();
                    string model = Console.ReadLine();

                    my.AddCar(make, model);

                    break;


                case "0":
                    flag = false;

                    break;

                default:
                    Console.WriteLine("Something went wrong");
                    break;
                }
            }
        }