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; }
internal void FillFuelEnergy(eFuelType i_FuelType, float i_AmountOfFuel) { if (i_FuelType != FuelType) { throw new ArgumentException("Wrong fuel type"); } else { CurrentFuel += i_AmountOfFuel; } }
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; }
public FuelEngine(eFuelType i_FuelType, float i_CurrenAmountOfFuelLiter, float i_MaxAmountOfFuelLiter) { m_FuelType = i_FuelType; m_CurrenAmountOfFuelLiter = i_CurrenAmountOfFuelLiter; m_MaxAmountOfFuelLiter = i_MaxAmountOfFuelLiter; }
public FuelEnergy(float i_MaxFuel, float i_CurrentFuel, eFuelType i_FuelType) : base(i_MaxFuel, i_CurrentFuel) { r_FuelType = i_FuelType; }
public GasEngine(eFuelType i_FuelType, float i_MaxOfTank) : base(i_MaxOfTank) { r_FuelType = i_FuelType; }
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"); }
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; }
public FuelEngine(eFuelType i_FuelType, float i_EnergyLevel, float i_MaxEnergyLevel) : base(i_EnergyLevel, i_MaxEnergyLevel) { m_FuelType = i_FuelType; }
internal FuelEngine(float i_MaxFuelAmount, eFuelType i_FuelType) : base(i_MaxFuelAmount) { m_FuelType = i_FuelType; }
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)); }
//// ctor public FuelEngine(float i_MaxEnergyCapacity, eFuelType i_FuelType) : base(i_MaxEnergyCapacity) { r_FuelType = i_FuelType; }
public Fuel(eFuelType i_EFuelType) { FuelType = i_EFuelType; }
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 }
public Gasolin(float i_maxOfQuantity, string i_typeOfGasolin) : base(i_maxOfQuantity) { m_fuelType = (eFuelType)Enum.Parse(typeof(eFuelType), i_maxOfQuantity.ToString()); }
public bool CheckFuelType(eFuelType i_FuelType) { return(this.m_FuelType == i_FuelType); }
public float StreamFuel(eFuelType i_type, float i_amount) { //TODO return(0f); }
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); }
public Fuel(eFuelType i_FuelType, float i_MaxAmoutOfFuel) : base(i_MaxAmoutOfFuel) { r_FuelType = i_FuelType; }
public FuelEngine(eFuelType i_FuelType, float i_MaxEnergyAmount) : base(i_MaxEnergyAmount) { r_FuelType = i_FuelType; }
public FuelVehicle(eFuelType i_FuelType, float i_MaxFuelAmountLitres) { m_FuelType = i_FuelType; r_MaxFuelAmountLitres = i_MaxFuelAmountLitres; }
//-----------------------------------------------------------------// 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);
public FuelSource(float i_MaxLiters, float i_CurrentAmount, eFuelType i_FuelType) : base(i_MaxLiters, i_CurrentAmount) { this.r_FuelType = i_FuelType; }
public Fuel(float i_MaximumAmountOfFuel, eFuelType i_FuelType) : base(i_MaximumAmountOfFuel) { m_FuelType = i_FuelType; }
/* * 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); } }
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"); } }
public FuelEngine(float i_MaxTankCapacity, eFuelType i_FuelType) : base(i_MaxTankCapacity, eEngineType.Fuel) { r_FuelType = i_FuelType; }
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(); } }
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())) { }
//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) { }
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()) { }
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; }
public void FuelGas(float i_GasAmount, eFuelType i_FuelType) { FuelBasedEnergy enegry = m_Energy as FuelBasedEnergy; enegry.FuelGas(i_GasAmount, i_FuelType); }
internal FuelEngine(eFuelType i_FuelType, float i_MaximumEnergySourceCapacity) : base(Engine.eEngineType.Fuel, i_MaximumEnergySourceCapacity) { r_FuelType = i_FuelType; }
private bool isSameFuelType(eFuelType i_FuelType) { bool result = false; if (i_FuelType.Equals(FuelType)) { result = true; } return result; }
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"); } }