Пример #1
0
        public static void ChargeVehicle(string i_VehicleLicensePlate, float i_AmountToCharge)
        {
            Vehicle vehicle = getVehicleByLicensePlate(i_VehicleLicensePlate);

            ElectricEnergy EnergyToCharge = vehicle.Energy as ElectricEnergy;

            if (EnergyToCharge == null)
            {
                throw new ArgumentException("Only Electric Based Vehicles are accepted.");
            }

            EnergyToCharge.ChargeBattery(i_AmountToCharge);
        }
Пример #2
0
        public void ChargeBattery(float i_ChargingTime)
        {
            ElectricEnergy energy = m_Energy as ElectricEnergy;

            if (energy != null)
            {
                energy.ChargeBattery(i_ChargingTime);
            }
            else
            {
                throw new ArgumentException("This motorcycle is not electric!");
            }
        }