Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        /*
         * 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);
            }
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 // methods:
 public void FillEnergy(string i_Amount, string i_Type)
 {
     m_Vehicle.FillEnergy(i_Amount, i_Type);
 }
Ejemplo n.º 5
0
 public void FillEnergy(int i_FuelType, float i_EnergyToAdd)
 {
     m_Vehicle.FillEnergy(i_FuelType, i_EnergyToAdd);
 }