private void refuel() { string stringToPrint; float amountOfFuelToAdd; FuelTank.eFuelType fuelType = new FuelTank.eFuelType(); string licenseNumber; stringToPrint = "Please enter the vehicle number"; UI.PrintString(stringToPrint.ToString()); licenseNumber = UI.ReadStringFromUser(); stringToPrint = "Please enter the fuel type you want to add"; UI.PrintString(stringToPrint.ToString()); fuelType = (FuelTank.eFuelType)UI.GetInputAccordingToEnum(fuelType); stringToPrint = "Please enter the amount of fuel you want to add"; UI.PrintString(stringToPrint.ToString()); amountOfFuelToAdd = UI.ReadFloatFromUser(); try { r_Garage.Refuel(licenseNumber, amountOfFuelToAdd, fuelType); } catch (Exception exception) { UI.PrintString(exception.Message); } }
private Vehicle.eVehicleType getVehicleType() { Vehicle.eVehicleType userChoice = new Vehicle.eVehicleType(); string stringToPrint = "Please choose type of vehicle:"; UI.PrintString(stringToPrint); userChoice = (Vehicle.eVehicleType)UI.GetInputAccordingToEnum(userChoice); return(userChoice); }
private EnergySource.eEnergySourceType getEnergySource(Vehicle.eVehicleType i_TypeOfVehicle) { bool isTruck = i_TypeOfVehicle == Vehicle.eVehicleType.Truck; string stringToPrint; EnergySource.eEnergySourceType energyType = new EnergySource.eEnergySourceType(); if (!isTruck) { stringToPrint = "Please choose the energy source:"; UI.PrintString(stringToPrint); energyType = (EnergySource.eEnergySourceType)UI.GetInputAccordingToEnum(energyType); } else { energyType = EnergySource.eEnergySourceType.Fuel; } return(energyType); }
private void changeTheStatusOfVehicle() { string stringToPrint; int userChoice; string licenseNumber; VehicleFolder.eVehicleStatus statusesInGarage = new VehicleFolder.eVehicleStatus(); stringToPrint = "Please enter the vehicle number"; UI.PrintString(stringToPrint); licenseNumber = UI.ReadStringFromUser(); userChoice = UI.GetInputAccordingToEnum(statusesInGarage); try { r_Garage.ChangeTheStatusOfCar(licenseNumber, (VehicleFolder.eVehicleStatus)userChoice); } catch (ArgumentException exception) { UI.PrintString(exception.Message); } }
private void displayVehiclesInGarage() { string stringToPrint; int userChoice = -1, allVehicles = 1; List <string> vehiclesToDisplay = null; stringToPrint = "Press 0 to display vehicles sorted according to status, and 1 to display all vehicles in the garage: "; UI.PrintString(stringToPrint.ToString()); userChoice = UI.ReadIntFromUser(); if (userChoice == allVehicles) { vehiclesToDisplay = r_Garage.DisplayAllVehiclesInGarage(null); } else { VehicleFolder.eVehicleStatus statusesInGarage = new VehicleFolder.eVehicleStatus(); userChoice = UI.GetInputAccordingToEnum(statusesInGarage); VehicleFolder.eVehicleStatus statusFilter = (VehicleFolder.eVehicleStatus)userChoice; vehiclesToDisplay = r_Garage.DisplayAllVehiclesInGarage(statusFilter); } UI.PrintStringList(vehiclesToDisplay); }