public void RechargeElectricity(string i_LicensePlate, float i_Amount) { Vehicle theVehicle = getVehicleInGarage(i_LicensePlate); ElectricEnergySource electricEnergySource = theVehicle.EnergySource as ElectricEnergySource; if (electricEnergySource == null) { throw new ArgumentException("license plate doesn't belong to electric vehicle"); } theVehicle.FillEnergy(i_Amount); }
/* * Fills the battery of a vehicle. * Throws a VehicleNotInGarageException if the vehicle doesn't found */ public void FillEnergy(string i_LicensePlateNumber, float i_EnergyToFill) { Vehicle vehicleToFill = SearchVehicle(i_LicensePlateNumber); if (vehicleToFill == null) { throw new VehicleNotInGarageException(); } else { vehicleToFill.FillEnergy(i_EnergyToFill); } }
public void RefillFuel(string i_LicensePlate, Enums.eFuelType i_FuelType, float i_Amount) { Vehicle theVehicle = getVehicleInGarage(i_LicensePlate); FuelEnergySource fuelEnergySource = theVehicle.EnergySource as FuelEnergySource; if (fuelEnergySource == null) { throw new ArgumentException("license plate doesn't belong to fuel vehicle"); } bool isCorrectFuelType = fuelEnergySource.IsCorrectFuelType(i_FuelType); if (!isCorrectFuelType) { throw new ArgumentException("fuel type is incorrect"); } theVehicle.FillEnergy(i_Amount); }
// methods: public void FillEnergy(string i_Amount, string i_Type) { m_Vehicle.FillEnergy(i_Amount, i_Type); }
public void FillEnergy(int i_FuelType, float i_EnergyToAdd) { m_Vehicle.FillEnergy(i_FuelType, i_EnergyToAdd); }