Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var garage = new Garage();

            Console.WriteLine("1. Add a car to the garage.");
            Console.WriteLine("2. Remove a car from the garage.");
            Console.WriteLine("3. List all cars.");
            Console.WriteLine("4. Test drive a car.");
            Console.WriteLine("5. Refuel all cars.");

            string menuChoice = Console.ReadLine();

            switch (menuChoice)
            {
            case "1":
                Console.WriteLine("What is the Make of your car?");
                var make = Console.ReadLine();
                Console.WriteLine("What is the Model of your car?");
                var model = Console.ReadLine();
                garage.AddCar(make, model);
                break;

            case "2":
                int carNum = Convert.ToInt32(Console.ReadLine());
                garage.RemoveCar(carNum);     //make this in garage as new method
                break;

            case "3":
                garage.ListAllCars();
                break;

            case "4":       //garage.TestDriveCar(); //make this in garage as new method
                Console.WriteLine("1. Turn on car");
                Console.WriteLine("2. Accelerate");
                Console.WriteLine("3. Brake");
                Console.WriteLine("4. Turn off car");
                Console.WriteLine("5. Return car");
                break;

            case "5":
                garage.FuelAllCars();
                break;

            default:
                Console.WriteLine("That wasn't an option! Try again.");
                break;
            }
        }