コード例 #1
0
        internal ElectricMotrobike(string i_ModelName, string i_LicenseNumber, float i_CurrentBatteryTimePrecent)
            : base(i_ModelName, i_LicenseNumber)
        {
            float currEnergy = i_CurrentBatteryTimePrecent * 1.2f / 100;

            m_VehicleEngineEnergy = new ElectricalEnergy(1.2f, currEnergy);
        }
コード例 #2
0
        internal ElectricCar(string i_LicenseNumber, string i_ModelName, float i_CurrentBatteryTimePrecent)
            : base(i_LicenseNumber, i_ModelName)
        {
            float currEnergy = i_CurrentBatteryTimePrecent * 2.1f / 100f;

            m_VehicleEngineEnergy = new ElectricalEnergy(2.1f, currEnergy);
        }
コード例 #3
0
        public void ChargeVehicle(string i_LicenseNumber, int i_AmountOfMinToCharge)
        {
            Client           client               = GetClient(i_LicenseNumber);
            float            chargeNumberInHour   = i_AmountOfMinToCharge / 60f;
            ElectricalEnergy electricEnergySystem = client.Vehicle.Energy as ElectricalEnergy;

            if (electricEnergySystem != null)
            {
                electricEnergySystem.BatteryCharge(chargeNumberInHour);
            }
            else
            {
                throw new FormatException("This vehicle has no electrical system");
            }
        }