private void getDetailsAndRefuel() { Console.WriteLine("Please enter the license number of the vehicle you would like to refuel"); string licenseNumber = ValidateUserInput.ValidateInputInNotEmpty(); Console.Clear(); Console.WriteLine("Please enter the type of fuel of the vehicle you would like to refuel"); Gas.eFuelType fuelType = (Gas.eFuelType)ValidateUserInput.InputIsInRangeOfEnum(typeof(Gas.eFuelType)); Console.Clear(); Console.WriteLine("Please enter the amount of fuel you would like to refuel"); float amountOfFuel = ValidateUserInput.ParseInputToFloat(); try { m_UserInterface.Garage.RefuelGasVehicle(licenseNumber, fuelType, amountOfFuel); Console.Clear(); Console.WriteLine(String.Format("Vehicle with license number: {0}, was refueled with gas type: {1}, and amount: {2} successfuly!", licenseNumber, fuelType, amountOfFuel)); Messages.PressAnyKeyToContinue(); } catch (Exception exception) { Console.Clear(); Console.WriteLine(exception.Message); if (exception is ValueOutOfRangeException) { Console.WriteLine("Please try again"); getDetailsAndRefuel(); } else { Messages.PressAnyKeyToContinue(); } } }
private void getDetailsAndChargeVehicle() { Console.WriteLine("Please enter the license number of the vehicle you would like to recharge"); string licenseNumber = ValidateUserInput.ValidateInputInNotEmpty(); Console.Clear(); Console.WriteLine("Please enter the number of minutes to charge"); float amountOfTimeToCharge = ValidateUserInput.ParseInputToFloat(); try { m_UserInterface.Garage.RechargeElectricVehicle(licenseNumber, amountOfTimeToCharge); Console.Clear(); Console.WriteLine(String.Format("Vehicle with license number: {0}, with amount: {1} successfuly!", licenseNumber, amountOfTimeToCharge)); Messages.PressAnyKeyToContinue(); } catch (Exception exception) { Console.Clear(); Console.WriteLine(exception.Message); if (exception is ValueOutOfRangeException) { Console.WriteLine("Please try again"); getDetailsAndChargeVehicle(); } else { Messages.PressAnyKeyToContinue(); } } }
private void setWheelsCurrentAirPressure(List <Wheel> wheels) { m_UserDisplay.ClearAndDisplayMessage("Please enter the current air pressure of the wheels"); float currentAirPressure = ValidateUserInput.ParseInputToFloat(); try { foreach (Wheel wheel in wheels) { wheel.PumpAir(currentAirPressure); } } catch (Exception exception) { m_UserDisplay.displayExceptionMessage(exception); setWheelsCurrentAirPressure(wheels); } }
private void setCurrentAmountOfEnergy(Vehicle vehicle) { if (vehicle.EnergySource is Gas) { m_UserDisplay.ClearAndDisplayMessage("Please enter current amount of fuel in liters"); } else { m_UserDisplay.ClearAndDisplayMessage("Please enter remaining time of engine operation in hours"); } float amountOfEnergy = ValidateUserInput.ParseInputToFloat(); try { vehicle.EnergySource.FillEnergy(amountOfEnergy); } catch (Exception exception) { m_UserDisplay.displayExceptionMessage(exception); setCurrentAmountOfEnergy(vehicle); } }
public float GetAmountOfMinutesToCharge() { m_UserDisplay.ClearAndDisplayMessage("Please enter the number of minutes to charge"); return(ValidateUserInput.ParseInputToFloat()); }
public float GetAmountOfLitersToFuel() { m_UserDisplay.ClearAndDisplayMessage("Please enter the amount of fuel you would like to refuel"); return(ValidateUserInput.ParseInputToFloat()); }
private float setMaxCarrey() { m_UserDisplay.ClearAndDisplayMessage("Please choose the truck maximum volume of cargo"); return(ValidateUserInput.ParseInputToFloat()); }