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

            Vehicle vehicle = new Vehicle();

            List <Vehicle> listOfVhehicles = new List <Vehicle>();

            Console.WriteLine("welcome to car mods");
            bool vehicleChoice = true;

            while (vehicleChoice)
            {
                Console.WriteLine(" Pick Your vehicle ");
                Console.WriteLine("1. Create a new Sports car");
                Console.WriteLine("2. create a new Suv");
                Console.WriteLine("3. Repair");
                Console.WriteLine("4. add gas");
                Console.WriteLine("5. Change tires");
                Console.WriteLine("6. Add armor");
                Console.WriteLine("7. improve Handling");
                Console.WriteLine("8. display vehicle status");
                Console.WriteLine("9. Quit");
                string menuChoice = Console.ReadLine();
                switch (menuChoice)
                {
                case "1":
                    Console.WriteLine("you have selected a sports car");
                    Console.WriteLine("what is the make of your Sports car?");
                    string make = Console.ReadLine();
                    Console.WriteLine("what is the model of your sports car?");
                    string model = Console.ReadLine();
                    vehicle = new SportsCar(make, model);
                    garage.AddVehicle(vehicle);
                    Console.ReadKey();
                    break;

                case "2":
                    Console.WriteLine("you have selected a Suv");
                    Console.WriteLine("what is the make of your Suv?");
                    make = Console.ReadLine();
                    Console.WriteLine("what is the model of your suv?");
                    model   = Console.ReadLine();
                    vehicle = new Suv(make, model);
                    garage.AddVehicle(vehicle);
                    Console.ReadKey();
                    break;

                case "3":
                    Console.WriteLine("you have repaired your vehicle");
                    vehicle.Repair();
                    vehicle.Tick();
                    break;

                case "4":
                    Console.WriteLine("you have refueled your vehicle");
                    vehicle.Refuel();
                    vehicle.Tick();
                    break;

                case "5":
                    Console.WriteLine("you have changed the tires on your vehicle");
                    vehicle.ChangeTires();
                    vehicle.Tick();
                    break;

                case "6":
                    Console.WriteLine("you have added armor on your vehicle");
                    vehicle.AddAmor();
                    vehicle.Tick();
                    break;

                case "7":
                    Console.WriteLine("you have improved your handling on your vehicle");
                    vehicle.AddHandling();
                    vehicle.Tick();
                    break;

                case "8":
                    foreach (Vehicle vehicle1 in garage.ListOfVehicles)
                    {
                        vehicle1.DisplayStatus();
                        vehicle.Tick();
                    }
                    Console.WriteLine("status");
                    break;

                case "9":
                    vehicleChoice = false;
                    break;

                default:
                    Console.WriteLine("Invalid entry.");
                    break;
                }
                Console.WriteLine("Press Enter to continue.");
                Console.ReadKey();
                Console.Clear();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Garage myGarage = new Garage();

            Car myCar = new Car();

            Console.WriteLine("Welcome to the car service shop!");

            bool ServiceShop = true;

            do
            {
                myCar.Tick();

                Console.WriteLine("1. Check the overall status of a vehicle.");
                Console.WriteLine("2. Paint a different color");
                Console.WriteLine("3. Add air pressure to tires");
                Console.WriteLine("4. Let out all tire pressure.");
                Console.WriteLine("5. Add oil.");
                Console.WriteLine("6. Dump Oil.");
                Console.WriteLine("7. Check how many days your car has been in the shop.");
                Console.WriteLine("8. Exit the repair shop.");
                Console.WriteLine("9. Add new car to the shop.");

                string userChoice = Console.ReadLine().ToUpper();
                Console.Clear();

                switch (userChoice)
                {
                case "1":
                    myCar = myGarage.SelectCar();
                    Console.WriteLine($"Oil Level: {myCar.GetOil()}");
                    Console.WriteLine($"Tire Pressure: {myCar.GetPressure()}");
                    break;

                case "2":
                    myCar = myGarage.SelectCar();
                    Console.Clear();
                    Console.WriteLine($"Enter the new color of this {myCar.Make} {myCar.Model}");
                    string newColor = Console.ReadLine();
                    myCar.SetColor(newColor);
                    break;

                case "3":
                    myCar = myGarage.SelectCar();
                    myCar.AddPressure();
                    if (myCar.GetPressure() > 32)
                    {
                        Console.WriteLine("WHoa there. Lets not over inflate them. Check your manual");
                    }
                    else
                    {
                        Console.WriteLine("Air has been added to your tires");
                    }
                    Console.WriteLine($"Your tire pressure is now  {myCar.GetPressure()}");
                    break;

                case "4":
                    myCar = myGarage.SelectCar();
                    myCar.DumpPressure();
                    Console.WriteLine("All the pressure in your tires has been let out.");
                    break;

                case "5":
                    myCar = myGarage.SelectCar();
                    myCar.ChangeOil();
                    if (myCar.GetOil() > 70)
                    {
                        Console.WriteLine("Make sure you don't add to much.");
                    }
                    else
                    {
                        Console.WriteLine("Your oil has been changed.");
                    }
                    break;

                case "6":
                    myCar = myGarage.SelectCar();
                    Console.WriteLine("Your oil has been completely purged.");
                    myCar.DumpOil();
                    break;

                case "7":
                    Console.WriteLine($"Your car has been here for {myCar.DaysInShop} days.");
                    break;

                case "8":
                    ServiceShop = false;
                    Console.WriteLine("See you next time!");
                    break;

                case "9":
                    Console.WriteLine("Enter the color of the car.");
                    string color = Console.ReadLine();
                    Console.WriteLine("Enter the make of the car.");
                    string make = Console.ReadLine();
                    Console.WriteLine("Enter the model of your car.");
                    string model = Console.ReadLine();
                    myCar = new Car(color, make, model);
                    myGarage.AddCar(myCar);
                    break;

                case "10":



                default:
                    Console.WriteLine("Please enter a valid selection.");
                    break;
                }
                Console.WriteLine("Return to main menu");
                Console.ReadKey();
                Console.Clear();
            }while (ServiceShop);
        }