internal static Vehicle CreateVehicle(eVehicleType i_VehicleType, Dictionary <string, string> i_VehicleProperties) { Vehicle vehicle = null; switch (i_VehicleType) { case eVehicleType.Car: vehicle = new FuelCar(); break; case eVehicleType.ElectricCar: vehicle = new ElectricCar(); break; case eVehicleType.Motorcycle: vehicle = new FuelMotorcycle(); break; case eVehicleType.ElectricMotorcycle: vehicle = new ElectricMotorcycle(); break; case eVehicleType.Truck: vehicle = new Truck(); break; } vehicle.SetVehicleProperties(i_VehicleProperties); return(vehicle); }
internal static Dictionary <string, List <string> > GetVehicleProperties(eVehicleType i_VehicleType) { Vehicle vehicle = null; switch (i_VehicleType) { case eVehicleType.Car: vehicle = new FuelCar(); break; case eVehicleType.ElectricCar: vehicle = new ElectricCar(); break; case eVehicleType.Motorcycle: vehicle = new FuelMotorcycle(); break; case eVehicleType.ElectricMotorcycle: vehicle = new ElectricMotorcycle(); break; case eVehicleType.Truck: vehicle = new Truck(); break; } return(vehicle.GetVehicleProperties()); }
public static Vehicle CreateVehicle(eVehicleType i_VehicleType, string i_ModelName, string i_LicenseNumber) { Vehicle vehicleToCreate = null; switch (i_VehicleType) { case eVehicleType.FuelCar: vehicleToCreate = new FuelCar(i_ModelName, i_LicenseNumber); break; case eVehicleType.ElectricCar: vehicleToCreate = new ElectricCar(i_ModelName, i_LicenseNumber); break; case eVehicleType.FuelMotorcycle: vehicleToCreate = new FuelMotorcycle(i_ModelName, i_LicenseNumber); break; case eVehicleType.ElectricMotorcycle: vehicleToCreate = new ElectricMotorcycle(i_ModelName, i_LicenseNumber); break; case eVehicleType.FuelTruck: vehicleToCreate = new FuelTruck(i_ModelName, i_LicenseNumber); break; default: break; } return(vehicleToCreate); }
public static Vehicle MakeVehicle(Vehicle.eVehicleType i_VehicleType, DetailsOfVehicle i_DetailsOfVehicle) { Vehicle newVehicle = null; switch (i_VehicleType) { case Vehicle.eVehicleType.FuelCar: newVehicle = new FuelCar(i_DetailsOfVehicle as DetailsOfFuelCar); break; case Vehicle.eVehicleType.ElectricCar: newVehicle = new ElectricCar(i_DetailsOfVehicle as DetailsOfElectricCar); break; case Vehicle.eVehicleType.ElectricMotorcycle: newVehicle = new ElectricMotorcycle(i_DetailsOfVehicle as DetailsOfElectricMotorcycle); break; case Vehicle.eVehicleType.FuelMotorcycle: newVehicle = new FuelMotorcycle(i_DetailsOfVehicle as DetailsOfFuelMotorcycle); break; case Vehicle.eVehicleType.Truck: newVehicle = new FuelTruck(i_DetailsOfVehicle as DetailsOfFuelTruck); break; } return(newVehicle); }
public Vehicle InitVehicle(eVehicleTypes i_VehicleType) { Vehicle newVehicle = null; switch (i_VehicleType) { case eVehicleTypes.FUEL_CAR: newVehicle = new FuelCar(eFuel.OCTAN_96, r_MaxCarFuelCapability, eWheels.FOUR, r_MaxCarAirPessure); break; case eVehicleTypes.ELECTRIC_CAR: newVehicle = new ElectricCar(r_MaxCarBatteryCapabity, eWheels.FOUR, r_MaxCarAirPessure); break; case eVehicleTypes.FUEL_MOTORCYCLE: newVehicle = new FuelMotorcycle(eFuel.OCTAN_95, r_MaxMotorcycleFuelCapability, eWheels.TWO, r_MaxMotorcycleAirPessure); break; case eVehicleTypes.ELECTRIC_MOTORCYCLE: newVehicle = new ElectricMotorcycle(r_MaxMotorcycleBatteryCapabity, eWheels.TWO, r_MaxMotorcycleAirPessure); break; case eVehicleTypes.TRUCK: newVehicle = new Truck(eFuel.SOLER, r_MaxTruckFuelCapability, eWheels.SIXTEEN, r_MaxTruckAirPessure); break; default: throw new ArgumentException(string.Format("Invalid vehicle type - {0}", i_VehicleType.ToString())); } return(newVehicle); }
public static Vehicle CreateNewVehicle(eVehicleType i_VehicleType, string i_LicenseNumber) { Vehicle newVehicle; switch (i_VehicleType) { case eVehicleType.FuelCar: newVehicle = new FuelCar(i_LicenseNumber); break; case eVehicleType.ElectricCar: newVehicle = new ElectricCar(i_LicenseNumber); break; case eVehicleType.FuelMotorbike: newVehicle = new FuelMotorbike(i_LicenseNumber); break; case eVehicleType.ElectricMotorbike: newVehicle = new ElectricMotorbike(i_LicenseNumber); break; case eVehicleType.Truck: newVehicle = new Truck(i_LicenseNumber); break; default: throw new ArgumentException("Invalid vehicle type"); } return(newVehicle); }
public Vehicle GetVehicle(string i_VehicleType, string i_LicenseId, string i_NameOfModel, float i_EnergyPrecent) { Vehicle vehicle = null; if (i_VehicleType.Equals("Fuel Bike")) { vehicle = new FuelBike(i_LicenseId, i_NameOfModel, i_EnergyPrecent); } else if (i_VehicleType.Equals("Electric Bike")) { vehicle = new ElectricBike(i_LicenseId, i_NameOfModel, i_EnergyPrecent); } else if (i_VehicleType.Equals("Fuel Car")) { vehicle = new FuelCar(i_LicenseId, i_NameOfModel, i_EnergyPrecent); } else if (i_VehicleType.Equals("Electric Car")) { vehicle = new ElectricCar(i_LicenseId, i_NameOfModel, i_EnergyPrecent); } else if (i_VehicleType.Equals("Truck")) { vehicle = new Truck(i_LicenseId, i_NameOfModel, i_EnergyPrecent); } else { throw new FormatException("The Vheicle type doen't exist"); } return(vehicle); }
public static Vehicle Create(eVehicleTypes i_Identifier, List <object> i_ParamsArray, Wheel[] i_Wheels) { Vehicle vehicleToReturn = null; switch (i_Identifier) { case eVehicleTypes.FuelCar: vehicleToReturn = new FuelCar((string)i_ParamsArray[0], (string)i_ParamsArray[1], (float)i_ParamsArray[2], (eCarColor)i_ParamsArray[3], (eDoorsNumber)i_ParamsArray[4], i_Wheels); break; case eVehicleTypes.FuelMotorcycle: vehicleToReturn = new FuelMotorcycle((string)i_ParamsArray[0], (string)i_ParamsArray[1], (float)i_ParamsArray[2], (eLicenseTypes)i_ParamsArray[3], (int)i_ParamsArray[4], i_Wheels); break; case eVehicleTypes.ElectricMotorcycle: vehicleToReturn = new ElectricMotorcycle((string)i_ParamsArray[0], (string)i_ParamsArray[1], (float)i_ParamsArray[2], (eLicenseTypes)i_ParamsArray[3], (int)i_ParamsArray[4], i_Wheels); break; case eVehicleTypes.ElectricCar: vehicleToReturn = new ElectricCar((string)i_ParamsArray[0], (string)i_ParamsArray[1], (float)i_ParamsArray[2], (eCarColor)i_ParamsArray[3], (eDoorsNumber)i_ParamsArray[4], i_Wheels); break; case eVehicleTypes.Truck: vehicleToReturn = new Truck((string)i_ParamsArray[0], (string)i_ParamsArray[1], (float)i_ParamsArray[2], (bool)i_ParamsArray[3], (int)i_ParamsArray[4], i_Wheels); break; default: break; } return(vehicleToReturn); }
public static Vehicle CreateVehicle(eTypeOfVehicle i_TypeOfVehicle, string i_LicenseNumber) { Vehicle newVehicleToCreate = null; switch (i_TypeOfVehicle) { case eTypeOfVehicle.ElectricCar: newVehicleToCreate = new ElectricCar(i_LicenseNumber); break; case eTypeOfVehicle.ElectricMotorcycle: newVehicleToCreate = new ElectricMotorcycle(i_LicenseNumber); break; case eTypeOfVehicle.FuelTruck: newVehicleToCreate = new FuelTruck(i_LicenseNumber); break; case eTypeOfVehicle.FuelCar: newVehicleToCreate = new FuelCar(i_LicenseNumber); break; case eTypeOfVehicle.FuelMotorcycle: newVehicleToCreate = new FuelMotorcycle(i_LicenseNumber); break; } return(newVehicleToCreate); }
/** * This method creates the wanted vehicle type and returns it * Throws ArgumentException if no such vehicle exists */ public static Vehicle MakeVehicle(eVehicleType i_VehicleType) { Vehicle newVehicle; switch (i_VehicleType) { case eVehicleType.ElectricMotorcycle: newVehicle = new ElectricMotorcycle(); break; case eVehicleType.FuelMotorcycle: newVehicle = new FuelMotorcycle(); break; case eVehicleType.ElectricCar: newVehicle = new ElectricCar(); break; case eVehicleType.FuelCar: newVehicle = new FuelCar(); break; case eVehicleType.FuelTruck: newVehicle = new FuelTruck(); break; default: throw new ArgumentException(string.Format("The index {0} is not supported.", i_VehicleType)); } return(newVehicle); }
public static Vehicle createVehicleFromType(eVehicleType i_VehicletoCreate, string i_ModelName, string i_LicenceID, object i_UniqueParameter1, object i_UniqueParameter2, string i_WheelsManfacturer, float i_AmountOfCurrentEnergyLeft) { Vehicle newVehicle = new Vehicle(i_ModelName, i_LicenceID); if ((i_VehicletoCreate == eVehicleType.FuelMotorBike) || (i_VehicletoCreate == eVehicleType.ElectricMotorBike)) { eLicenceType licenceID = (eLicenceType)i_UniqueParameter1; int engineCapacity = (int)i_UniqueParameter2; if (i_VehicletoCreate == eVehicleType.FuelMotorBike) { FuelMotorBike newFuelMotorBike = new FuelMotorBike(i_ModelName, i_LicenceID, licenceID, engineCapacity, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft); newVehicle = newFuelMotorBike; newVehicle = newVehicle as FuelMotorBike; } else { ElectricMotorBike newElectricMotorBike = new ElectricMotorBike(i_ModelName, i_LicenceID, licenceID, engineCapacity, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft); newVehicle = newElectricMotorBike; newVehicle = newVehicle as ElectricMotorBike; } } else if ((i_VehicletoCreate == eVehicleType.FuelCar) || (i_VehicletoCreate == eVehicleType.ElectricCar)) { eCarColor carColor = (eCarColor)i_UniqueParameter1; eDoorsAmount doorsAmount = (eDoorsAmount)i_UniqueParameter2; if (i_VehicletoCreate == eVehicleType.FuelCar) { FuelCar newFuelCar = new FuelCar(i_ModelName, i_LicenceID, carColor, doorsAmount, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft); newVehicle = newFuelCar; newVehicle = newVehicle as FuelCar; } else { ElectricCar newElectricCar = new ElectricCar(i_ModelName, i_LicenceID, carColor, doorsAmount, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft); newVehicle = newElectricCar; newVehicle = newVehicle as ElectricCar; } } else if (i_VehicletoCreate == eVehicleType.Truck) { bool carryingToxic = (bool)i_UniqueParameter1; float loadVolume = (float)i_UniqueParameter2; Truck newTruck = new Truck(i_ModelName, i_LicenceID, carryingToxic, loadVolume, i_WheelsManfacturer, i_AmountOfCurrentEnergyLeft); newVehicle = newTruck; newVehicle = newVehicle as Truck; } else { throw new ArgumentException(); } if (newVehicle == null) { throw new FormatException(); } return(newVehicle); }
public static Vehicle MakeNewVehicle(eVehicle i_TypeToCreate, string i_ModelName, string i_LicensePlateNumber, out List <string> o_QuestionsToAsk, out List <string> o_Attributes) { switch (i_TypeToCreate) { case eVehicle.ElectricCar: { o_QuestionsToAsk = ElectricCar.GetQuestions(); o_Attributes = ElectricCar.GetAtributes(); return(new ElectricCar(i_ModelName, i_LicensePlateNumber, 4, 32, 2.1f)); } case eVehicle.FuelCar: { o_QuestionsToAsk = FuelCar.GetQuestions(); o_Attributes = FuelCar.GetAtributes(); return(new FuelCar(i_ModelName, i_LicensePlateNumber, 4, 32, FuelVehicle.eFuel.Octan96, 60)); } case eVehicle.ElectricMotorcycle: { o_QuestionsToAsk = ElectricMotorcycle.GetQuestions(); o_Attributes = ElectricMotorcycle.GetAtributes(); return(new ElectricMotorcycle(i_ModelName, i_LicensePlateNumber, 2, 30, 1.2f)); } case eVehicle.FuelMotorcycle: { o_QuestionsToAsk = FuelMotorcycle.GetQuestions(); o_Attributes = FuelMotorcycle.GetAtributes(); return(new FuelMotorcycle(i_ModelName, i_LicensePlateNumber, 2, 30, FuelVehicle.eFuel.Octan95, 7)); } case eVehicle.Truck: { o_QuestionsToAsk = Truck.GetQuestions(); o_Attributes = Truck.GetAtributes(); return(new Truck(i_ModelName, i_LicensePlateNumber, 16, 28, FuelVehicle.eFuel.Soler, 120)); } default: { o_QuestionsToAsk = null; o_Attributes = null; return(null); } } }
public static Vehicle MakeVehicle(eVehicleType i_VehicleType, List <object> i_Values) { Vehicle vehicle = null; switch (i_VehicleType) { case eVehicleType.ElectricBike: { vehicle = new ElectricBike(i_Values[0].ToString(), i_Values[1].ToString(), i_Values[4].ToString(), (float)i_Values[5], (eLicenseType)i_Values[6], (int)i_Values[7]); break; } case eVehicleType.FuelBike: { vehicle = new FuelBike(i_Values[0].ToString(), i_Values[1].ToString(), i_Values[4].ToString(), (float)i_Values[5], (eLicenseType)i_Values[6], (int)i_Values[7]); break; } case eVehicleType.ElectricCar: { vehicle = new ElectricCar(i_Values[0].ToString(), i_Values[1].ToString(), i_Values[4].ToString(), (float)i_Values[5], (eCarColor)i_Values[6], (eNumOfDoors)i_Values[7]); break; } case eVehicleType.FuelCar: { vehicle = new FuelCar(i_Values[0].ToString(), i_Values[1].ToString(), i_Values[4].ToString(), (float)i_Values[5], (eCarColor)i_Values[6], (eNumOfDoors)i_Values[7]); break; } case eVehicleType.Truck: { vehicle = new Truck(i_Values[0].ToString(), i_Values[1].ToString(), i_Values[4].ToString(), (float)i_Values[5], (bool)i_Values[6], (float)i_Values[7]); break; } } return(vehicle); }
public void SetCarAdditionalParams(string i_LicenseNumber, int i_VehicleColor, int i_NumOfDoors) { GarageVehicle garageVehicle = VehiclesInGarage[i_LicenseNumber]; eColors color = checkIfValidColorParam(i_VehicleColor); eDoors numOfDoors = checkIfValidDoorsParam(i_NumOfDoors); if (garageVehicle.Vehicle is FuelCar) { FuelCar fuelCar = garageVehicle.Vehicle as FuelCar; fuelCar.CarDetails.VehicleColor = color; fuelCar.CarDetails.NumOfDoors = numOfDoors; } else if (garageVehicle.Vehicle is ElectricCar) { ElectricCar electricCar = garageVehicle.Vehicle as ElectricCar; electricCar.CarDetails.VehicleColor = color; electricCar.CarDetails.NumOfDoors = numOfDoors; } }
// $G$ CSS-999 (-3) Public/internal methods should start with an Uppercase letter. internal static Vehicle createVehicle(string i_LicenseNumber, int i_VehicleType) { Vehicle newVehicle = null; eVehicleType vehicleType = (eVehicleType)i_VehicleType; switch (vehicleType) { case eVehicleType.FuelMotorcycle: { newVehicle = new FuelMotorcycle(i_LicenseNumber); break; } case eVehicleType.ElectricMotorcycle: { newVehicle = new ElectricMotorcycle(i_LicenseNumber); break; } case eVehicleType.FuelCar: { newVehicle = new FuelCar(i_LicenseNumber); break; } case eVehicleType.ElectricCar: { newVehicle = new ElectricCar(i_LicenseNumber); break; } case eVehicleType.FuelTruck: { newVehicle = new FuelTruck(i_LicenseNumber); break; } } return(newVehicle); }
public static Vehicle CreateVehicle(int i_VehicleType, string i_ModelName, string i_LicenceNumber) { Vehicle newVehicle = null; try { eVehicleType vehicleType = (eVehicleType)i_VehicleType; switch (vehicleType) { case eVehicleType.FuelCar: newVehicle = new FuelCar(i_ModelName, i_LicenceNumber); break; case eVehicleType.ElectricCar: newVehicle = new ElectricCar(i_ModelName, i_LicenceNumber); break; case eVehicleType.ElectricMotorcycle: newVehicle = new ElectricMotorcycle(i_ModelName, i_LicenceNumber); break; case eVehicleType.FuelMotorcycle: newVehicle = new FuelMotorcycle(i_ModelName, i_LicenceNumber); break; case eVehicleType.FuelTruck: newVehicle = new FuelTruck(i_ModelName, i_LicenceNumber); break; } } catch { throw new ArgumentException("No matching vehicle was found!!"); } return(newVehicle); }
public Vehicle CreateVehicle() { try { Vehicle vehicleToCreate; switch (m_VehicleToCreate) { case eTypeOfVehicles.ElectricCar: vehicleToCreate = new ElectricCar(); break; case eTypeOfVehicles.ElectricMotorcycle: vehicleToCreate = new ElectricMotorcycle(); break; case eTypeOfVehicles.FuelCar: vehicleToCreate = new FuelCar(); break; case eTypeOfVehicles.FuelMotorcycle: vehicleToCreate = new FuelMotorcycle(); break; case eTypeOfVehicles.Truck: vehicleToCreate = new Truck(); break; default: throw new ArgumentException(r_ErrorMessage); } return(vehicleToCreate); } catch (Exception ex) { throw new Exception(r_ErrorMessage, ex); } }
public static Vehicle CreateNewVehicle(Garage i_Garage, eVehicleTypes vehicleType, Dictionary <string, string> i_Properties) { Vehicle i_Vehicle; bool creationSuccess = false; string modelName = "", licensePlate = "", manufacture = ""; float engineCapacity = 0, loadVolume = 0; bool isCarryingDangerousLoad = false; eCarDoors door = eCarDoors.Five; eColor color = eColor.Black; eLicenseType licenseType = eLicenseType.A; foreach (KeyValuePair <string, string> pairs in i_Properties) { switch (pairs.Key) { case "Model Name": modelName = pairs.Value; break; case "License Plate": licensePlate = pairs.Value; break; case "Manufacture": manufacture = pairs.Value; break; case "Car Color": eColor.TryParse(pairs.Value, out color); break; case "Number of Doors": eCarDoors.TryParse(pairs.Value, out door); break; case "Engine Capacity CCS": engineCapacity = float.Parse(pairs.Value); break; case "License Type": eLicenseType.TryParse(pairs.Value, out licenseType); break; case "Is carrying dangerous load": isCarryingDangerousLoad = bool.Parse(pairs.Value); break; case "Load Volume": loadVolume = float.Parse(pairs.Value); break; } } switch (vehicleType) { case eVehicleTypes.ElectronicCar: i_Vehicle = new ElectricCar(modelName, licensePlate, color, door, manufacture); //ElectricCar.TryParse(i_Properties, out newVehicle); break; case eVehicleTypes.ElectronicMotorCycle: i_Vehicle = new ElectricMotorCycle(modelName, licensePlate, engineCapacity, eLicenseType.A1, manufacture); break; case eVehicleTypes.FuelCar: i_Vehicle = new FuelCar(modelName, licensePlate, color, door, manufacture); //FuelCar.TryParse(i_Properties, out newVehicle); break; case eVehicleTypes.FuelMotorCycle: i_Vehicle = new FuelMotorCycle(modelName, licensePlate, engineCapacity, licenseType, manufacture); break; case eVehicleTypes.Truck: i_Vehicle = new Truck(modelName, licensePlate, manufacture, isCarryingDangerousLoad, loadVolume); break; default: i_Vehicle = null; break; } return(i_Vehicle); }
public FuelCar CreateNewFuelCar(FuelEngine i_FuelVehicle, eNumberOfDoors i_NumberOfDoors, eCarColor i_CarColor, string i_ModelName, string i_LicenseNumber, float i_ThePercentageOfEnergyLeft, List <Wheel> i_Wheels) { FuelCar fuelCar = new FuelCar(i_FuelVehicle, i_NumberOfDoors, i_CarColor, i_ModelName, i_LicenseNumber, i_ThePercentageOfEnergyLeft, i_Wheels); return(fuelCar); }
public static Vehicle GenerateVehicle(GarageENums.eVehicleType i_VehicleType, List <object> i_VehicleInfo) { Vehicle newVehicle = null; switch (i_VehicleType) { case GarageENums.eVehicleType.FuelCar: newVehicle = new FuelCar((string)i_VehicleInfo[0], (string)i_VehicleInfo[1], (string)i_VehicleInfo[2], (string)i_VehicleInfo[3], (float)i_VehicleInfo[4], (float)i_VehicleInfo[5], (string)i_VehicleInfo[6], (Car.eCarColor)i_VehicleInfo[7], (Car.eNumberOfCarDoors)i_VehicleInfo[8]); break; case GarageENums.eVehicleType.ElectricCar: newVehicle = new ElectricCar((string)i_VehicleInfo[0], (string)i_VehicleInfo[1], (string)i_VehicleInfo[2], (string)i_VehicleInfo[3], (float)i_VehicleInfo[4], (float)i_VehicleInfo[5], (string)i_VehicleInfo[6], (Car.eCarColor)i_VehicleInfo[7], (Car.eNumberOfCarDoors)i_VehicleInfo[8]); break; case GarageENums.eVehicleType.FuelMotorcycle: newVehicle = new FuelMotorcycle((string)i_VehicleInfo[0], (string)i_VehicleInfo[1], (string)i_VehicleInfo[2], (string)i_VehicleInfo[3], (float)i_VehicleInfo[4], (float)i_VehicleInfo[5], (string)i_VehicleInfo[6], (Motorcycle.eMotorcycleLicenseType)i_VehicleInfo[7], (int)i_VehicleInfo[8]); break; case GarageENums.eVehicleType.ElectricMotorcycle: newVehicle = new ElectricMotorcycle((string)i_VehicleInfo[0], (string)i_VehicleInfo[1], (string)i_VehicleInfo[2], (string)i_VehicleInfo[3], (float)i_VehicleInfo[4], (float)i_VehicleInfo[5], (string)i_VehicleInfo[6], (Motorcycle.eMotorcycleLicenseType)i_VehicleInfo[7], (int)i_VehicleInfo[8]); break; case GarageENums.eVehicleType.FuelTruck: newVehicle = new FuelTruck((string)i_VehicleInfo[0], (string)i_VehicleInfo[1], (string)i_VehicleInfo[2], (string)i_VehicleInfo[3], (float)i_VehicleInfo[4], (float)i_VehicleInfo[5], (string)i_VehicleInfo[6], (float)i_VehicleInfo[7], (bool)i_VehicleInfo[8]); break; } return(newVehicle); }
public static FuelCar createFuelCar(Car i_Car, FuelVehicle.eFuelType i_FuelType, float i_CurrentAmountOfFuel, string i_Model, string i_LicensePlateNumber, float i_PercentOfRemainingEnergy, List <Tire> i_Tires) { FuelCar newFuelCar = new FuelCar(i_Car, i_FuelType, i_CurrentAmountOfFuel, i_Model, i_LicensePlateNumber, i_PercentOfRemainingEnergy, i_Tires); return(newFuelCar); }
/*7. Display vehicle information (License number, Model name, Owner name, Status in * garage, Tire specifications(manufacturer and air pressure), Fuel status + Fuel type * Battery status, other relevant information based on vehicle type)*/ public List <object> GetFullVehicleDetails(string i_LicenseNumber) { List <object> fullDetails = new List <object>(); eVehicleType vehicleType = GetVehicleTypeByLicenseNumber(i_LicenseNumber); Vehicle currentVehicle = GetVehicleByLicense(i_LicenseNumber); VehicleInfo currentVehicleInfo = GetVehicleInfoByLicense(i_LicenseNumber); fullDetails.Add(vehicleType); fullDetails.Add(currentVehicle.LicenseNumber); fullDetails.Add(currentVehicle.ModelName); fullDetails.Add(currentVehicleInfo.OwnerName); fullDetails.Add(currentVehicleInfo.OwnerPhoneNumber); fullDetails.Add(currentVehicleInfo.Status); fullDetails.Add(currentVehicle.Wheels[0].MaxAirPressure); switch (vehicleType) { case eVehicleType.ElectricBike: { ElectricBike electricBike = (ElectricBike)currentVehicle; fullDetails.Add(electricBike.LicenseType); fullDetails.Add(electricBike.EngineCCVolume); fullDetails.Add(electricBike.MaximalBatteryTime); fullDetails.Add(electricBike.RemainingBatteryTime); for (int i = 0; i < electricBike.Wheels.Count; i++) { fullDetails.Add(electricBike.Wheels[i].CurrentAirPressure); fullDetails.Add(electricBike.Wheels[i].ManufacturerName); } break; } case eVehicleType.ElectricCar: { ElectricCar electricCar = (ElectricCar)currentVehicle; fullDetails.Add(electricCar.CarColor); fullDetails.Add(electricCar.NumOfDoors); fullDetails.Add(electricCar.MaximalBatteryTime); fullDetails.Add(electricCar.RemainingBatteryTime); for (int i = 0; i < electricCar.Wheels.Count; i++) { fullDetails.Add(electricCar.Wheels[i].CurrentAirPressure); fullDetails.Add(electricCar.Wheels[i].ManufacturerName); } break; } case eVehicleType.FuelBike: { FuelBike fuelBike = (FuelBike)currentVehicle; fullDetails.Add(fuelBike.LicenseType); fullDetails.Add(fuelBike.EngineCCVolume); fullDetails.Add(fuelBike.EnergyType); fullDetails.Add(fuelBike.MaximalFuelLevel); fullDetails.Add(fuelBike.CurrentFuelLevel); for (int i = 0; i < fuelBike.Wheels.Count; i++) { fullDetails.Add(fuelBike.Wheels[i].CurrentAirPressure); fullDetails.Add(fuelBike.Wheels[i].ManufacturerName); } break; } case eVehicleType.FuelCar: { FuelCar fuelCar = (FuelCar)currentVehicle; fullDetails.Add(fuelCar.CarColor); fullDetails.Add(fuelCar.NumOfDoors); fullDetails.Add(fuelCar.EnergyType); fullDetails.Add(fuelCar.MaximalFuelLevel); fullDetails.Add(fuelCar.CurrentFuelLevel); for (int i = 0; i < fuelCar.Wheels.Count; i++) { fullDetails.Add(fuelCar.Wheels[i].CurrentAirPressure); fullDetails.Add(fuelCar.Wheels[i].ManufacturerName); } break; } case eVehicleType.Truck: { Truck truck = (Truck)currentVehicle; fullDetails.Add(truck.MaximalFuelLevel); fullDetails.Add(truck.CurrentFuelLevel); fullDetails.Add(truck.EnergyType); fullDetails.Add(truck.IsCarryingHazards); fullDetails.Add(truck.MaxLoadAllowed); for (int i = 0; i < truck.Wheels.Count; i++) { fullDetails.Add(truck.Wheels[i].CurrentAirPressure); fullDetails.Add(truck.Wheels[i].ManufacturerName); } break; } default: { break; } } return(fullDetails); }