public static void ValidateFuelType(EnergyType i_Energy) { if (!(i_Energy == EnergyType.Fuel)) { throw new ArgumentException(); } }
public Truck(string i_Model, string i_LicenseNumber, EnergyType i_SourceOfEnergy, Wheel i_Wheel) : base(i_Model, i_LicenseNumber, i_SourceOfEnergy) { AddWheels(i_Wheel, k_NumOfWheels, Wheel.eMaxAirPressure.Truck); EnergySetup(i_SourceOfEnergy); m_IsDangerous = false; }
public Vehicle(string i_Model, string i_LicenseNumber, EnergyType i_SourceOfEnergy) { r_Model = i_Model; r_LicenseNumber = i_LicenseNumber; r_Wheels = new List <Wheel>(); m_Source = i_SourceOfEnergy; }
public Motorcycle(eLicenseTypes o_LicenseType, int o_EngineVolume, EnergyType o_TypeOfEnergy, string o_ModelName, string o_LicensePlate, OwnerDetails o_MotorcycleOwner, List <Wheel> o_Wheels) : base(o_ModelName, o_LicensePlate, o_MotorcycleOwner, o_Wheels) { m_licenseType = o_LicenseType; m_engineVolume = o_EngineVolume; m_EnergyType = o_TypeOfEnergy; EnergyRatio = o_TypeOfEnergy.CalculateRatio(); }
//WE will pass Fuel as i_EnergyType then the base constrctour will set the energy to fuel, public Truck(string i_m_ModelName, string i_LicenseNumber, List <Wheels> i_ListOfWheels, EnergyType i_EnergyType, float i_CarGoCapcity, bool i_ContainsDangerousMaterials) : base(i_m_ModelName, i_LicenseNumber, i_ListOfWheels, i_EnergyType) { this.r_CarGoCapcity = i_CarGoCapcity; this.r_ContainsDangerousMaterials = i_ContainsDangerousMaterials; }
internal Car(string i_m_ModelName, string i_LicenseNumber, List <Wheels> i_ListOfWheels, EnergyType i_EnergyType, eNumberOfDoors i_NumberOfDoors, eCarColor i_CarColor) : base(i_m_ModelName, i_LicenseNumber, i_ListOfWheels, i_EnergyType) { this.r_CarColor = i_CarColor; this.r_NumberOfDoors = i_NumberOfDoors; }
public Car(eCarColors i_ChosenColor, eNumberOfDoors i_CarDoors, EnergyType o_TypeOfEnergy, string o_ModelName, string o_LicensePlate, OwnerDetails o_CarOwner, List <Wheel> o_Wheels) : base(o_ModelName, o_LicensePlate, o_CarOwner, o_Wheels) { m_CarColor = i_ChosenColor; m_NumberOfDoors = i_CarDoors; m_EnergyType = o_TypeOfEnergy; EnergyRatio = o_TypeOfEnergy.CalculateRatio(); }
internal Motorcycle(string i_m_ModelName, string i_LicenseNumber, List <Wheels> i_ListOfWheels, EnergyType i_EnergyType, eLicenseType i_LicenseType, int i_EngineVolume) : base(i_m_ModelName, i_LicenseNumber, i_ListOfWheels, i_EnergyType) { this.r_LicenseType = i_LicenseType; this.r_EngineVolume = i_EngineVolume; }
public Vehicle(string i_ModelName, string i_LicenseNumber, List <Wheels> i_ListOfWheels, EnergyType i_EnergyType) { this.m_EnergyTpye = i_EnergyType; this.r_LicenseNumber = i_LicenseNumber; this.r_ModelName = i_ModelName; this.r_Wheels = i_ListOfWheels; this.m_EnergyPercentageLeft = CalculateEnergyPercentageLeft(m_EnergyTpye.m_CurrentAmountOfEnergy, m_EnergyTpye.r_MaxAmountOfEnergy); }
public static void ValidateElectriclType(EnergyType i_Energy) { if (i_Energy == EnergyType.Electric) { } else { throw new ArgumentException(); } }
public void fuelVehicle(string i_LicencePlate, EnergyType i_FuelType, float i_AddedFuel) { VehicleInGarage vehicleInGarage = find(i_LicencePlate); if (vehicleInGarage == null) { throw new Exception("Can't fuel! The vehicle's license plate is not found"); } vehicleInGarage.Vehicle.FillTank(i_AddedFuel, i_FuelType); }
public override void EnergySetup(EnergyType i_SourceOfEnergy) { if (i_SourceOfEnergy is Fuel) { i_SourceOfEnergy.MaxEnergyCapacity = (float)Fuel.eMaxFuelCapacity.Truck; i_SourceOfEnergy.CurrentEnergyCapacity = (float)Fuel.eMaxFuelCapacity.Truck; ((Fuel)i_SourceOfEnergy).FuelType = Fuel.eFuelType.Soler; } else { throw new FormatException("A truck energy type should be only fuel!"); } }
public override string ToString() { string vehicleInfo = string.Format( "Owner's name: {1}{0}Owner's phone: {2}{0}Model: {3}{0}Registration Plate: {4}{0}Number Of Wheels: {5}{0}", Environment.NewLine, m_OwnersName, m_OwnersPhone, r_Model, r_RegistrationPlate, m_NumberOfWheels); return(vehicleInfo + m_Wheels[0].ToString() + EnergyType.ToString()); }
public override void EnergySetup(EnergyType i_SourceOfEnergy) { if (i_SourceOfEnergy is Fuel) { i_SourceOfEnergy.MaxEnergyCapacity = (float)Fuel.eMaxFuelCapacity.Car; i_SourceOfEnergy.CurrentEnergyCapacity = (float)Fuel.eMaxFuelCapacity.Car; ((Fuel)i_SourceOfEnergy).FuelType = Fuel.eFuelType.Octan96; } else { i_SourceOfEnergy.MaxEnergyCapacity = k_MaxElectricCapacity; i_SourceOfEnergy.CurrentEnergyCapacity = k_MaxElectricCapacity; } }
public void FillTank(float i_EnergyToAdd, EnergyType i_FuelType) { if (r_EnergyType != i_FuelType) { throw new ArgumentException(); } if (i_EnergyToAdd < 0 || m_CurrentCapacity + i_EnergyToAdd > r_MaxCapacity) { throw new ValueOutOfRangeException(0, r_MaxCapacity - m_CurrentCapacity); } m_CurrentCapacity += i_EnergyToAdd; }
void CheckAndCreateEngineType(ENumType.eEnergytype i_EngineType, ENumType.eFuelType i_FuelType) { switch (i_EngineType) { case ENumType.eEnergytype.Gasoline: { m_MyEngine = new GasolineEngine(m_EnergyPercentage, r_MaxEnergyCapacity, i_FuelType); break; } case ENumType.eEnergytype.Elecrtic: { m_MyEngine = new ElectricEngine(m_EnergyPercentage, r_MaxEnergyCapacity); break; } } }
public static Vehicle CreateNewVehicle( Vehicle.eVehicleType i_VehicleType, string i_Model, string i_LicenseNumber, EnergyType i_SourceOfEnergy, Wheel i_Wheel) { Vehicle newVehicle = null; if (i_VehicleType == Vehicle.eVehicleType.ElectricCar || i_VehicleType == Vehicle.eVehicleType.FuelCar) { newVehicle = new Car(i_Model, i_LicenseNumber, i_SourceOfEnergy, i_Wheel); } else if (i_VehicleType == Vehicle.eVehicleType.Truck) { newVehicle = new Truck(i_Model, i_LicenseNumber, i_SourceOfEnergy, i_Wheel); } else { newVehicle = new Motorcycle(i_Model, i_LicenseNumber, i_SourceOfEnergy, i_Wheel); } return(newVehicle); }
protected void asssaignEnergySourceToElectric(ref VehicleEnergy io_Energy, float i_CurrentAmount, float i_MaxAmount, EnergyType i_Electric) { ElectricEnergy.ValidateElectriclType(i_Electric); io_Energy = new ElectricEnergy(i_CurrentAmount, i_MaxAmount); PercentOfEnergyLeft = percentOfEnergyLeftCalculation(i_CurrentAmount, i_MaxAmount); }
protected void asssaignEnergySourceToFuel(ref VehicleEnergy io_Energy, eFuelType i_FuelType, float i_CurrentAmount, float i_MaxAmount, EnergyType i_Fuel) { FuelEnergy.ValidateFuelType(i_Fuel); io_Energy = new FuelEnergy(i_FuelType, i_CurrentAmount, i_MaxAmount); PercentOfEnergyLeft = percentOfEnergyLeftCalculation(i_CurrentAmount, i_MaxAmount); }
public void FillTank(float i_EnergyToAdd, EnergyType i_FuelType) { m_Tank.FillTank(i_EnergyToAdd, i_FuelType); }
public abstract void EnergySetup(EnergyType i_SourceOfEnergy);
public Tank(EnergyType i_FuelType, float i_MaxCapacity) { r_EnergyType = i_FuelType; r_MaxCapacity = i_MaxCapacity; }
public Car(string i_Model, string i_LicenseNumber, EnergyType i_SourceOfEnergy, Wheel i_Wheel) : base(i_Model, i_LicenseNumber, i_SourceOfEnergy) { EnergySetup(i_SourceOfEnergy); AddWheels(i_Wheel, k_NumOfWheels, Wheel.eMaxAirPressure.Car); }