public static void UpdateSupportedTruckValues(Truck i_NewVehicle) { i_NewVehicle.Wheels = new List <Wheel>(); for (int i = 0; i < 16; i++) { i_NewVehicle.Wheels.Add(new Wheel()); i_NewVehicle.Wheels[i].MaxManufactureAirPressure = 28; } FuelTank fuleMotorcycleToUpdat = i_NewVehicle.EnergySource as FuelTank; fuleMotorcycleToUpdat._FuelType = FuelType.eFuelType.Soler; fuleMotorcycleToUpdat.MaxSourceAmount = 120; }
public static Vehicle CreatingNewVehicleToGarage(string i_LicennseNumber, SupportedVehicles.eSupportedVehicles i_VehicleType) { Vehicle newVehicle = null; switch (i_VehicleType) { case SupportedVehicles.eSupportedVehicles.FuelMotorcycle: { FuelTank FuelTank = new FuelTank(); newVehicle = new Motorcycle(i_LicennseNumber, FuelTank); break; } case SupportedVehicles.eSupportedVehicles.ElectricMotorcycle: { Battery battery = new Battery(); newVehicle = new Motorcycle(i_LicennseNumber, battery); break; } case SupportedVehicles.eSupportedVehicles.FuelCar: { FuelTank fuelTank = new FuelTank(); newVehicle = new Car(i_LicennseNumber, fuelTank); break; } case SupportedVehicles.eSupportedVehicles.ElectricCar: { Battery battery = new Battery(); newVehicle = new Car(i_LicennseNumber, battery); break; } case SupportedVehicles.eSupportedVehicles.FuelTruck: { FuelTank fuelTank = new FuelTank(); newVehicle = new Truck(i_LicennseNumber, fuelTank); break; } } SupportedVehicles.UpdateSupportedValues(newVehicle); return(newVehicle); }
public void FuelVehicle(string i_LicenseNumber, eFuel i_FuelType, float i_AmountOFuelToAdd) { VehicleInfo vehicleInfo = r_Vehicles[i_LicenseNumber]; if (vehicleInfo.Vehicle != null) { FuelTank fuelTank = vehicleInfo.Vehicle.EnergySource as FuelTank; if (i_FuelType == fuelTank.FuelType) { fuelTank.Fuel(i_AmountOFuelToAdd); } else { throw new FuelTypeException(i_FuelType, fuelTank.FuelType); } } else { throw new VehicleNotExistException(i_LicenseNumber); } }
public string RefuelingAVehicle(string i_LicenseNumberToReful, string i_FuelType, string i_AmountOfLitersToAdd) { string loadMessage; Vehicle vehicleToLoad; m_VehicleInTheGarage.TryGetValue(i_LicenseNumberToReful.GetHashCode(), out vehicleToLoad); if (vehicleToLoad.EnergySource is FuelTank) { FuelTank currentVehicleFuelTank = vehicleToLoad.EnergySource as FuelTank; currentVehicleFuelTank.Refueling(float.Parse(i_AmountOfLitersToAdd), FuelType.ParseFromString(i_FuelType));///check EXP caching loadMessage = string.Format("The vehicle {0} refueling was successful.", i_LicenseNumberToReful); } else { throw new ArgumentException(string.Format("The vehicle with the license number: {0} is electric vehicle.", i_LicenseNumberToReful)); } updatePrecentOfenergy(i_LicenseNumberToReful, i_AmountOfLitersToAdd); return(loadMessage); }
public void PumpFuelToVehicle(string i_VehicleLicenceNumber, int i_SelectedFuelType, float i_AmountOfPropulsionToAdd) { FuelType.eFuelType currentPumpedFuel; AllGarageVehicles.TryGetValue(i_VehicleLicenceNumber.GetHashCode(), out Vehicle o_CurrentVehicle); switch (i_SelectedFuelType) { case 1: currentPumpedFuel = FuelType.eFuelType.Octan98; break; case 2: currentPumpedFuel = FuelType.eFuelType.Octan96; break; case 3: currentPumpedFuel = FuelType.eFuelType.Octan95; break; case 4: currentPumpedFuel = FuelType.eFuelType.Soler; break; default: currentPumpedFuel = 0; break; } FuelTank tankToBeFueld = o_CurrentVehicle.Propulsion as FuelTank; if (currentPumpedFuel == tankToBeFueld.FuelType) { tankToBeFueld.PumpFuelToTank(i_AmountOfPropulsionToAdd, currentPumpedFuel); o_CurrentVehicle.UpdateVehicleCurrentPropulsion(); } else { throw new ArgumentException("Fuel type does not match! Didn't fuel vehicle..."); } }
public static void UpdateSupportedMotorcycleValues(Motorcycle i_NewVehicle) { i_NewVehicle.Wheels = new List <Wheel>(); for (int i = 0; i < 2; i++) { i_NewVehicle.Wheels.Add(new Wheel()); i_NewVehicle.Wheels[i].MaxManufactureAirPressure = 30; } if (i_NewVehicle.EnergySource is FuelTank) { FuelTank fuleMotorcycleToUpdat = i_NewVehicle.EnergySource as FuelTank; fuleMotorcycleToUpdat._FuelType = FuelType.eFuelType.Octan95; fuleMotorcycleToUpdat.MaxSourceAmount = 7; } else { Battery fuleMotorcycleToUpdat = i_NewVehicle.EnergySource as Battery; fuleMotorcycleToUpdat.MaxSourceAmount = float.Parse("1.2"); } }
private static Truck createATruck(string i_Module, string i_VehicleLicense, float i_CurrentPowerInPowerSource, List <string> i_Wheels, Dictionary <string, string> i_VehicleDetails) { FuelTank fuelTank = new FuelTank(135f, i_CurrentPowerInPowerSource, PowerSource.eFuel.Octan96); string valueOfToxic; i_VehicleDetails.TryGetValue("carriesToxic", out valueOfToxic); bool isToxic = bool.Parse(valueOfToxic); string valueOfCarrayWeight; i_VehicleDetails.TryGetValue("maxCarryWeight", out valueOfCarrayWeight); float maxCarryWeight = float.Parse(valueOfCarrayWeight); if (maxCarryWeight < 0) { throw new FormatException("Cannot put negative value in the max Carry weight of the truck"); } List <Wheel> wheels = generateWheels(12, 32, i_Wheels[0], i_Wheels[1]); return(new Truck(i_Module, i_VehicleLicense, isToxic, maxCarryWeight, wheels, fuelTank)); }
public Truck(string i_VehicleModelName, string i_VehicleLicenceNumber, string i_WheelManufacturerName) : base(i_VehicleModelName, i_VehicleLicenceNumber, k_AmountOfWheels, i_WheelManufacturerName, k_MaxAirPressure) { Propulsion = new FuelTank(FuelType.eFuelType.Soler, 110); }
public FuelCar(string i_VehicleModelName, string i_VehicleLicenceNumber, string i_WheelManufacturerName) : base(i_VehicleModelName, i_VehicleLicenceNumber, i_WheelManufacturerName) { Propulsion = new FuelTank(FuelType.eFuelType.Octan96, 55); }