public Car(string i_CarModelName, string i_LicensePlate, EngineType.eEnergySource i_EnergySource, string i_WheelManufacturerName, float i_CurrentAirPressure, float i_CurrentEnergyAmount) : base(i_CarModelName, i_LicensePlate, i_EnergySource) { for (int i = 0; i < k_NumberOfWheels; i++) { Wheels.Add(new Wheel(i_WheelManufacturerName, (float)Wheel.eMaxAirPressure.Car, i_CurrentAirPressure)); } SetEnergy(i_CurrentEnergyAmount); }
public Vehicle(string i_CarModelName, string i_LicensePlate, EngineType.eEnergySource i_EnergySource) { m_VehicleModelName = i_CarModelName; m_LicensePlate = i_LicensePlate; if (i_EnergySource == EngineType.eEnergySource.Fuel) { m_EnergySource = new Fuel(); } else { m_EnergySource = new Electricity(); } }
public void GetEnergySource(out EngineType.eEnergySource i_EnergySource) { const int numberOfUserOptions = 2; int userSelection; string menu = string.Format(@"Please select engine type 1.Fuel 2.Electricity"); System.Console.WriteLine(menu); string input = System.Console.ReadLine(); checkUserSelection(input, numberOfUserOptions); userSelection = int.Parse(input); i_EnergySource = (EngineType.eEnergySource)userSelection; }
public static Vehicle CreateVehicle(string i_LicensePlate, string i_ModelName, string i_WheelManufacturer, EngineType.eEnergySource i_EnergySource, eVehiclesType i_VehiclesType, float i_CurrentAirPressure, float i_CurrentEnergyAmount) { Vehicle newVehicle = null; switch (i_VehiclesType) { case eVehiclesType.Car: newVehicle = new Car(i_ModelName, i_LicensePlate, i_EnergySource, i_WheelManufacturer, i_CurrentAirPressure, i_CurrentEnergyAmount); break; case eVehiclesType.Motorcycle: newVehicle = new Motorcycle(i_ModelName, i_LicensePlate, i_EnergySource, i_WheelManufacturer, i_CurrentAirPressure, i_CurrentEnergyAmount); break; case eVehiclesType.Truck: newVehicle = new Truck(i_ModelName, i_LicensePlate, i_WheelManufacturer, i_CurrentAirPressure, i_CurrentEnergyAmount); break; } return(newVehicle); }