private static VehicleInputData GetVehicleDataFromUser() { VehicleInputData o_VehicleData = new VehicleInputData(); GetVehicleLicenseNumberFromUser(out o_VehicleData.m_LicenseNumber); GetVehicleTypeFromUser(out o_VehicleData.m_VehicleType); GetVehicleModelNameFromUser(out o_VehicleData.m_ModelName); GetVehicleSpecificDataFromUserByType(o_VehicleData.m_VehicleType, o_VehicleData); GetWheelsDataFromUser(out o_VehicleData.m_WheelsManufacturer, out o_VehicleData.m_CurrentAirPressure, out o_VehicleData.m_MaxAirPressure); return(o_VehicleData); }
private static void GetVehicleSpecificDataFromUserByType(eVehicleType i_VehicleType, VehicleInputData o_VehicleData) { switch (i_VehicleType) { case eVehicleType.Car: case eVehicleType.ElectricCar: GetVehicleColorFromUser(out o_VehicleData.m_Color); GetVehicleNumberOfDoorsFromUser(out o_VehicleData.m_Doors); break; case eVehicleType.Motorcycle: case eVehicleType.ElectricMotorcycle: GetVehicleLicenseTypeFromUser(out o_VehicleData.m_LicenseType); GetVehicleEngineCapacityFromUser(out o_VehicleData.m_EngineCapacity); break; case eVehicleType.Truck: GetVehicleDangerousSubstancesDataFromUser(out o_VehicleData.m_ContainDangerousSubstances); GetVehicleCargoVolumeFromUser(out o_VehicleData.m_CargoVolume); break; default: break; } switch (i_VehicleType) { case eVehicleType.Car: case eVehicleType.Motorcycle: case eVehicleType.Truck: GetVehicleFuelDataFromUser(out o_VehicleData.m_FuelType, out o_VehicleData.m_CurrentFuelCapacity, out o_VehicleData.m_MaxFuelCapacity); break; case eVehicleType.ElectricCar: case eVehicleType.ElectricMotorcycle: GetVehicleBatteryDataFromUser(out o_VehicleData.m_RemainingBatteryTime, out o_VehicleData.m_MaxBatteryTime); break; default: break; } }
public static void AddNewVehicleToGarage(Garage i_Garage) { string ownerNameInput = string.Empty; string ownerPhoneNumberInput = string.Empty; //VehicleInputData o_VehicleData; //GetOwnerNameFromUser(out ownerNameInput); //GetOwnerPhoneNumberFromUser(out ownerPhoneNumberInput); //o_VehicleData = GetVehicleDataFromUser(); ////// Example Car ////// ownerNameInput = "Ilan Kushnir"; ownerPhoneNumberInput = "0505877898"; VehicleInputData o_VehicleData = new VehicleInputData(); o_VehicleData.m_Color = Car.eCarColor.Red; o_VehicleData.m_CurrentAirPressure = 30; o_VehicleData.m_CurrentFuelCapacity = 40; o_VehicleData.m_Doors = Car.eNumOfDoors.Three; o_VehicleData.m_FuelType = Fuel.eFuelType.Octan95; o_VehicleData.m_LicenseNumber = "1234567"; o_VehicleData.m_MaxAirPressure = 32; o_VehicleData.m_MaxFuelCapacity = 50; o_VehicleData.m_ModelName = "The Off-Mobil"; o_VehicleData.m_VehicleType = eVehicleType.Car; o_VehicleData.m_WheelsManufacturer = "Michelin abu hasuna"; ///////////////////////// try { i_Garage.AddVehicleToGarage(ownerNameInput, ownerPhoneNumberInput, o_VehicleData); Console.WriteLine("The car added successfuly to the garage" + Environment.NewLine); } catch (VehicleAllreadyInGarageException ex) { Console.WriteLine("Vehicle with license number " + ex.LicenseNumber + " is allready taken care in the garage. Status changed to InService"); } }