예제 #1
0
 public void SearchVehicleByType(Garage <Vehicle> garage)
 {
     ConsoleUI.ShowVehiclesTypes(garage.SearchVehicleByType());
 }
예제 #2
0
        private static void ParkAVehicleMenu(Garage <Vehicle> garage)
        {
            var input = Utils.AskForNumber("Select the vehicle type you want to park"
                                           + "\n1 - Airplane"
                                           + "\n2 - Motorcycle"
                                           + "\n3 - Car"
                                           + "\n4 - Bus"
                                           + "\n5 - Boat"
                                           + "\n0. Go back to the garage menu"
                                           + "\n ____________________________");

            var RegNr          = "Registration number:";
            var Color          = "Color:";
            var Manufacturer   = "Manufacturer:";
            var NumberOfWheels = "Number of wheels:";
            var ProductionYear = "Year of production:";

            switch (input)
            {
            case 1:
                var airplane = new Airplane(
                    regNr: Utils.AskForInput(RegNr),
                    manufacturer: Utils.AskForInput(Manufacturer),
                    numberOfWheels: Utils.AskForNumber(NumberOfWheels),
                    color: Utils.AskForInput(Color),
                    productionYear: Utils.AskForNumber(ProductionYear),
                    numberOfEngines: Utils.AskForNumber("Number of engines:")
                    );
                garageHandler.ParkVehicle(garage, airplane);
                ParkAVehicleMenu(garage);
                break;

            case 2:
                var motorcycle = new Motorcycle(
                    regNr: Utils.AskForInput(RegNr),
                    manufacturer: Utils.AskForInput(Manufacturer),
                    numberOfWheels: Utils.AskForNumber(NumberOfWheels),
                    color: Utils.AskForInput(Color),
                    productionYear: Utils.AskForNumber(ProductionYear),
                    cylinderVolume: Utils.AskForNumber("Cylinder volume:")
                    );
                garageHandler.ParkVehicle(garage, motorcycle);
                ParkAVehicleMenu(garage);
                break;

            case 3:
                var car = new Car(
                    regNr: Utils.AskForInput(RegNr),
                    manufacturer: Utils.AskForInput(Manufacturer),
                    numberOfWheels: Utils.AskForNumber(NumberOfWheels),
                    color: Utils.AskForInput(Color),
                    productionYear: Utils.AskForNumber(ProductionYear),
                    fuelType: Utils.AskForInput("Fuel type:")
                    );
                garageHandler.ParkVehicle(garage, car);
                ParkAVehicleMenu(garage);
                break;

            case 4:
                var bus = new Bus(
                    regNr: Utils.AskForInput(RegNr),
                    manufacturer: Utils.AskForInput(Manufacturer),
                    numberOfWheels: Utils.AskForNumber(NumberOfWheels),
                    color: Utils.AskForInput(Color),
                    productionYear: Utils.AskForNumber(ProductionYear),
                    numberOfSeats: Utils.AskForNumber("Number of seats:")
                    );
                garageHandler.ParkVehicle(garage, bus);
                ParkAVehicleMenu(garage);
                break;

            case 5:
                var boat = new Boat(
                    regNr: Utils.AskForInput(RegNr),
                    manufacturer: Utils.AskForInput(Manufacturer),
                    numberOfWheels: Utils.AskForNumber(NumberOfWheels),
                    color: Utils.AskForInput(Color),
                    productionYear: Utils.AskForNumber(ProductionYear),
                    length: Utils.AskForNumber("Length:")
                    );
                garageHandler.ParkVehicle(garage, boat);
                ParkAVehicleMenu(garage);
                break;

            case 0:
                GarageMenu(garage);
                break;

            default:
                Console.WriteLine("Please select a valid option!\n");
                ParkAVehicleMenu(garage);
                break;
            }
        }
예제 #3
0
 public void ListParkedVehicles(Garage <Vehicle> garage)
 {
     ConsoleUI.ShowParkedVehicles(garage.ListParkedVehicles());
 }