public FuelEngine(eFuelType i_FuelType, float i_CurrentEnergy, float i_MaxEnergy)
            : base(i_CurrentEnergy, i_MaxEnergy)
        {
            if (i_CurrentEnergy > i_MaxEnergy)
            {
                throw new ValueOutOfRangeException(0, i_MaxEnergy);
            }

            m_EngineType = eEngineType.Fuel;
            r_FuelType = i_FuelType;
        }
示例#2
0
 internal void FillFuelEnergy(eFuelType i_FuelType, float i_AmountOfFuel)
 {
     if (i_FuelType != FuelType)
     {
         throw new ArgumentException("Wrong fuel type");
     }
     else
     {
         CurrentFuel += i_AmountOfFuel;
     }
 }
示例#3
0
        public void Refuel(float i_FuelQuantity, eFuelType i_FuelType)
        {
            // Checks that they have the same fuel type
            if (isSameFuelType(i_FuelType))
            {
                throw new ArgumentException();
            }

            float refuelCalculation = m_FuelQuantity + i_FuelQuantity;

            // Checks that we do not receive an overflow of fuel tank
            if (refuelCalculation > FuelMaxCapacity)
            {
                throw new ValueOutOfRangeException();
            }

            // Refuels
            FuelMaxCapacity = refuelCalculation;
        }
        public static string StringFromType(eFuelType i_FuelType)
        {
            string result;

            switch (i_FuelType)
            {
                case eFuelType.Octan95:
                    result = "Octan 95";
                    break;
                    case eFuelType.Octan96:
                    result = "Octan 96";
                    break;
                    case eFuelType.Octan98:
                    result = "Octan 98";
                    break;
                    case eFuelType.Soler:
                    result = "Soler";
                    break;
                default:
                    throw new ArgumentException("Unknown fuel type");
            }

            return result;
        }
示例#5
0
 public FuelEngine(eFuelType i_FuelType, float i_CurrenAmountOfFuelLiter, float i_MaxAmountOfFuelLiter)
 {
     m_FuelType = i_FuelType;
     m_CurrenAmountOfFuelLiter = i_CurrenAmountOfFuelLiter;
     m_MaxAmountOfFuelLiter    = i_MaxAmountOfFuelLiter;
 }
示例#6
0
 public FuelEnergy(float i_MaxFuel, float i_CurrentFuel, eFuelType i_FuelType)
     : base(i_MaxFuel, i_CurrentFuel)
 {
     r_FuelType = i_FuelType;
 }
示例#7
0
 public GasEngine(eFuelType i_FuelType, float i_MaxOfTank)
     : base(i_MaxOfTank)
 {
     r_FuelType = i_FuelType;
 }
示例#8
0
 internal FuelEngine(Dictionary <string, string> i_FuelEngineInfo) : base(i_FuelEngineInfo["Current fuel amount:"], i_FuelEngineInfo["max fuel amount:"])
 {
     m_FuelType = PropertiesValidation.EnumTryParse <eFuelType>(i_FuelEngineInfo["Fuel type:"], "Fuel type");
 }
示例#9
0
        private float m_MaxAmountOfFuel;      // In liters.

        /* Constructor */
        // Default constructor for the use of VehicleMaker class
        public FuelBasedVehicle() : base()
        {
            this.m_FuelType            = eFuelType.Unknown;
            this.m_CurrentAmountOfFuel = 0;
            this.m_MaxAmountOfFuel     = 0;
        }
 internal FuelEngine(eFuelType i_FuelType)
     : base(eEngineType.Fuel)
 {
     m_FuelType = i_FuelType;
 }
示例#11
0
 public FuelEngine(eFuelType i_FuelType, float i_EnergyLevel, float i_MaxEnergyLevel) :
     base(i_EnergyLevel, i_MaxEnergyLevel)
 {
     m_FuelType = i_FuelType;
 }
示例#12
0
 internal FuelEngine(float i_MaxFuelAmount, eFuelType i_FuelType)
     : base(i_MaxFuelAmount)
 {
     m_FuelType = i_FuelType;
 }
示例#13
0
 private static FuelEngine CreateFuelEngine(float i_MaxFuelTank, float i_CurrentFuelTank, eFuelType i_FuelType)
 {
     if (i_MaxFuelTank < i_CurrentFuelTank)
     {
         throw new ValueOutOfRangeException("Energy amount", 0, i_MaxFuelTank);
     }
     return(new FuelEngine(i_FuelType, i_CurrentFuelTank, i_MaxFuelTank));
 }
示例#14
0
 //// ctor
 public FuelEngine(float i_MaxEnergyCapacity, eFuelType i_FuelType) : base(i_MaxEnergyCapacity)
 {
     r_FuelType = i_FuelType;
 }
 public Fuel(eFuelType i_EFuelType)
 {
     FuelType = i_EFuelType;
 }
示例#16
0
文件: Gasolin.cs 项目: sigalbi/Garage
 public void checkAndUpdateFuelType(string i_input) // this function check the fuel type input and update the data member
 {
     m_fuelType = CheckFuelType(i_input);           // call to function that check the fual type
 }
示例#17
0
文件: Gasolin.cs 项目: sigalbi/Garage
 public Gasolin(float i_maxOfQuantity, string i_typeOfGasolin) : base(i_maxOfQuantity)
 {
     m_fuelType = (eFuelType)Enum.Parse(typeof(eFuelType), i_maxOfQuantity.ToString());
 }
示例#18
0
 public bool CheckFuelType(eFuelType i_FuelType)
 {
     return(this.m_FuelType == i_FuelType);
 }
 public float StreamFuel(eFuelType i_type, float i_amount)
 {
     //TODO
     return(0f);
 }
示例#20
0
        private void getVehicleFuelType()
        {
            bool isValidMenuInput = true;

            do
            {
                try
                {
                    m_VehicleFuelType = (eFuelType)parseEnumUserInput(
            @"Please enter the Fuel Type by choosing a number from the menu:
            1. Octan95
            2. Octan96
            3. Octan98
            4. Soler",
             typeof(eLicenseType));

                    isValidMenuInput = Enum.IsDefined(typeof(eFuelType), m_VehicleFuelType);
                    if (!isValidMenuInput)
                    {
                        Console.WriteLine("Invalid Fuel type input");
                    }
                }
                catch (ArgumentException ex)
                {
                    isValidMenuInput = false;
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    isValidMenuInput = false;
                    Console.WriteLine(ex.Message);
                }
            }
            while (!isValidMenuInput);
        }
示例#21
0
 public Fuel(eFuelType i_FuelType, float i_MaxAmoutOfFuel) : base(i_MaxAmoutOfFuel)
 {
     r_FuelType = i_FuelType;
 }
示例#22
0
 public FuelEngine(eFuelType i_FuelType, float i_MaxEnergyAmount)
     : base(i_MaxEnergyAmount)
 {
     r_FuelType = i_FuelType;
 }
示例#23
0
 public FuelVehicle(eFuelType i_FuelType, float i_MaxFuelAmountLitres)
 {
     m_FuelType            = i_FuelType;
     r_MaxFuelAmountLitres = i_MaxFuelAmountLitres;
 }
示例#24
0
 //-----------------------------------------------------------------//
 public FuelEngine(eFuelType i_FuelType, float i_MaxFuel)
 {
     this.m_FuelType        = i_FuelType;
     this.m_MaxFuelCapacity = i_MaxFuel;
 }
 public abstract void ProvideSourceEnergy(float i_FuelToAdd, eFuelType i_FuelType);
示例#26
0
 public FuelSource(float i_MaxLiters, float i_CurrentAmount, eFuelType i_FuelType) : base(i_MaxLiters, i_CurrentAmount)
 {
     this.r_FuelType = i_FuelType;
 }
示例#27
0
 public Fuel(float i_MaximumAmountOfFuel, eFuelType i_FuelType) : base(i_MaximumAmountOfFuel)
 {
     m_FuelType = i_FuelType;
 }
示例#28
0
        /*
         * Fills the fuel tank of vehicle with given license plate number.
         */
        public void FillEnergySource(string i_LicensePlateNumber, float i_AmountToFill, eFuelType i_FuelType)
        {
            Vehicle vehicleToFillEnergySource = search(i_LicensePlateNumber);

            if (vehicleToFillEnergySource == null)
            {
                throw new VehicleNotInGarageException();
            }
            else
            {
                vehicleToFillEnergySource.FillEnergySource(i_AmountToFill, i_FuelType);
            }
        }
示例#29
0
        public void RefuelingVehicle(string i_VehicleLicenseNumber, eFuelType i_FuelType, float i_AmountOfFuelToAdd)
        {
            Vehicle refueledVehicle = null;
            Fuel fuel = new Fuel();

            refueledVehicle = searchVehicleByLicenseNumber(i_VehicleLicenseNumber);
            fuel.FuelType = i_FuelType;
            try
            {
                refueledVehicle.LoadEnergy(i_AmountOfFuelToAdd, fuel);
            }
            catch (FormatException)
            {
                throw new FormatException("The vehicle's energy source is not fuel");
            }
        }
示例#30
0
 public FuelEngine(float i_MaxTankCapacity, eFuelType i_FuelType) : base(i_MaxTankCapacity, eEngineType.Fuel)
 {
     r_FuelType = i_FuelType;
 }
示例#31
0
 public GasEngine(float i_MaxFuelQuantity, eFuelType i_FuelType) : base(i_MaxFuelQuantity)
 {
     r_FuelType = i_FuelType;
 }
        private void doFillGasoline()
        {
            try
            {
                Console.WriteLine("Fueling gasoline vehicle:");
                m_UserVehicleID = ConsoleUtils.ParseVehicleID();
                if (existsWithID())
                {
                    Console.WriteLine("Enter fuel amount in liters: ");
                    m_UserEnergyAmount = ConsoleUtils.ParseEnergyAmount();
                    m_UserFuelType = ConsoleUtils.ParseFuelType();
                    GasStation.Instance.SetPump(m_UserFuelType, m_UserEnergyAmount);
                    getVehicleFromUserID().FillEnergy();
                    Console.WriteLine("Fuel filled.");

                    return;
                }

                printNotFound();
            }
            catch (EngineMismatchException ex)
            {
                Console.WriteLine(ex.Message);
                waitForKeyPress();
            }
            catch (FuelMismatchException ex)
            {
                Console.WriteLine(ex.Message);
                waitForKeyPress();
            }
            catch (ValueOutOfRangeException ex)
            {
                Console.WriteLine(ex.Message);
                waitForKeyPress();
            }
        }
示例#33
0
 public WrongFuelTypeException(eFuelType i_WrongFuelType, eFuelType i_AppropriateFuelType)
     : base(string.Format("{0} is not the appropriate fuel, it has to be {1}",
                          i_WrongFuelType.ToString(), i_AppropriateFuelType.ToString()))
 {
 }
示例#34
0
        //public Car(eTypeOfEnergy i_TypeOfEnergy, string[] i_Details)
        //{
        //    //Vehicle(i_TypeOfEnergy, i_FuelType, i_FuelTankVolume, i_NumOfTires, i_MaxAirPressure)
        //}

        public Car(eTypeOfEnergy i_TypeOfEnergy, eFuelType i_FuelType, float i_FuelTankVolume, int i_NumOfTires, float i_MaxAirPressure) : base(i_TypeOfEnergy, i_FuelType, i_FuelTankVolume, i_NumOfTires, i_MaxAirPressure)
        {
        }
示例#35
0
 public void SetFuelType(eFuelType i_FuelType)
 {
     this.m_FuelType = i_FuelType;
 }
 public FuelMismatchException(eFuelType i_RequiredFuelType)
     : base("Engine required fuel of type " + i_RequiredFuelType.ToString())
 {
 }
示例#37
0
 public Car(string i_ModelName, string i_LicenseNumber, eCarColor i_Color, int i_NumOfDoors, eTypeOfEnergy i_TypeOfEnergy, eFuelType i_FuelType, float i_CurrFuelAmount, float i_TankVolume) : base(i_ModelName, i_LicenseNumber, i_TypeOfEnergy, i_FuelType, i_TankVolume)
 {
     m_CarColor   = i_Color;
     m_NumOfDoors = (eNumOfDoors)i_NumOfDoors;
 }
示例#38
0
        public void FuelGas(float i_GasAmount, eFuelType i_FuelType)
        {
            FuelBasedEnergy enegry = m_Energy as FuelBasedEnergy;

            enegry.FuelGas(i_GasAmount, i_FuelType);
        }
示例#39
0
 internal FuelEngine(eFuelType i_FuelType, float i_MaximumEnergySourceCapacity)
     : base(Engine.eEngineType.Fuel, i_MaximumEnergySourceCapacity)
 {
     r_FuelType = i_FuelType;
 }
示例#40
0
        private bool isSameFuelType(eFuelType i_FuelType)
        {
            bool result = false;
            if (i_FuelType.Equals(FuelType))
            {
                result = true;
            }

            return result;
        }
示例#41
0
文件: Garage.cs 项目: ZivFoox/Garage
        public void FuelingVehicle(string i_PlateNum, float i_GasForFueling, eFuelType i_FuelType)
        {
            if (IsVehicleNumberExist(i_PlateNum))
            {
                FuelEnergy fuelEnergy = r_ListOfVehicles[i_PlateNum].EnergySourceType as FuelEnergy;

                if (fuelEnergy == null)
                {
                    throw new ArgumentException("The vehicle is not running on fuel!");
                }
                else
                {
                    fuelEnergy.FillFuelEnergy(i_FuelType, i_GasForFueling);
                }

                r_ListOfVehicles[i_PlateNum].UpdateCurrentEnergyPercentage();
            }
            else
            {
                throw new ArgumentException("The vehicle was not found");
            }
        }