Exemplo n.º 1
0
 public override void AddEnergy(float i_EnergyToAdd, eTypeOfFuel i_TypeOfFuel)
 {
     if (m_CurrentAmountOfEnergy + i_EnergyToAdd <= m_MaximalAmountOfEnergy)
     {
         m_CurrentAmountOfEnergy += i_EnergyToAdd;
     }
 }
Exemplo n.º 2
0
 public void FuelTypeValidation(eTypeOfFuel i_FuelType)
 {
     if (FuelType != i_FuelType)
     {
         throw new ArgumentException();
     }
 }
Exemplo n.º 3
0
        public void RefuelingOperation(float i_QuantityOfGallons, eTypeOfFuel i_TypeOfGas)

        {
            if (i_TypeOfGas != TypeOfGas)
            {
                throw new ArgumentException();
            }

            AddEnergy(i_QuantityOfGallons);
        }
Exemplo n.º 4
0
 public void AddFuelToCar(eTypeOfFuel i_TypeOfFuel, float i_AmountOfFuelToAdd)
 {
     if (i_TypeOfFuel != this.r_TypeOfFuel)
     {
         throw new ArgumentException();
     }
     else
     {
         this.LoadEnergySource(i_AmountOfFuelToAdd);
     }
 }
        public bool IsTypeOfFuelMatch(string i_RegistrationNumber, eTypeOfFuel i_FuelType)
        {
            bool isMatch = false;

            foreach (Vehicle vehicle in m_Vehicles)
            {
                if (vehicle.RegistrationPlate == i_RegistrationNumber)
                {
                    if (((FuelledEngine)vehicle.Engine).TypeOfFuel == i_FuelType)
                    {
                        isMatch = true;
                    }
                }
            }

            return(isMatch);
        }
        public eRefuelStatus Refuel(float i_AmountOfFuelToAdd, eTypeOfFuel i_TypeOfFuel, bool i_ThrowException = true)
        {
            eRefuelStatus status;

            if (float.IsNaN(i_AmountOfFuelToAdd))
            {
                if (i_ThrowException)
                {
                    throw new ArgumentNaNException("i_AmountOfFuelToAdd");
                }
                status = eRefuelStatus.AmountOfFuelToAddIsNaN;
            }
            else if (float.IsInfinity(i_AmountOfFuelToAdd))
            {
                if (i_ThrowException)
                {
                    throw new ArgumentInfinityException("i_AmountOfFuelToAdd");
                }
                status = eRefuelStatus.AmountOfFuelToAddIsInfinity;
            }
            else
            {
                if (i_TypeOfFuel != r_TypeOfFuel)
                {
                    status = eRefuelStatus.TypesOfFuelsAreIncompatible;
                }
                else if (m_RemainingAmountOfFuelInTheTank + i_AmountOfFuelToAdd > r_CapacityOfTank)
                {
                    status = eRefuelStatus.FuelTankOverflow;
                }
                else
                {
                    m_RemainingAmountOfFuelInTheTank += i_AmountOfFuelToAdd;
                    status = eRefuelStatus.Success;
                }
            }

            return(status);
        }
Exemplo n.º 7
0
 public void AddEnergy(float i_EnergyToAdd, eTypeOfFuel i_TypeOfFuel)
 {
     m_Engine.AddEnergy(i_EnergyToAdd, i_TypeOfFuel);
 }
Exemplo n.º 8
0
 public GasTank(eTypeOfFuel i_FuelType, float i_MaxAmountOfFuel) : base(i_MaxAmountOfFuel)
 {
     this.r_TypeOfFuel = i_FuelType;
 }
Exemplo n.º 9
0
 public virtual void AddEnergy(float i_EnergyToAdd, eTypeOfFuel i_TypeOfFuel)
 {
 }
Exemplo n.º 10
0
 public void AddEnergyToVehicle(string i_VehicleRegistrationPlate, float i_AmountOfEnergyToAdd, eTypeOfFuel i_TypeOfFuel)
 {
     foreach (Vehicle vehicle in m_Vehicles)
     {
         if (vehicle.RegistrationPlate == i_VehicleRegistrationPlate)
         {
             vehicle.AddEnergy(i_AmountOfEnergyToAdd, i_TypeOfFuel);
         }
     }
 }
Exemplo n.º 11
0
 public FuelEnergy(float i_MaximumAmountOfFuelInLiters, float i_AmountOfFuelPresentInLiters, eTypeOfFuel TypeOfFuel) :
     base(i_MaximumAmountOfFuelInLiters, i_AmountOfFuelPresentInLiters)
 {
     TypeOfGas = TypeOfFuel;
 }
Exemplo n.º 12
0
 public Information(float i_RemainingAmountOfFuel, float i_CapacityOfTank, eTypeOfFuel i_TypeOfFuel)
 {
     r_RemainingAmountOfFuel = i_RemainingAmountOfFuel;
     r_CapacityOfTank        = i_CapacityOfTank;
     r_TypeOfFuel            = i_TypeOfFuel;
 }