// $G$ DSN-002 (-5) The UI should not know Car\Truck\Motorcycle private void getCarDataFromUser(ref Car io_Car) { string userInput; MenuScreen doorsAmountScreen = r_Screens[eUIScreens.AmountOfDoors] as MenuScreen; MenuScreen carColorScreen = r_Screens[eUIScreens.VehicleColor] as MenuScreen; doorsAmountScreen.Display(out userInput); eAmountOfDoors amountOfDoors = (eAmountOfDoors)parseMenuOption(userInput); io_Car.AmountOfDoors = amountOfDoors; carColorScreen.Display(out userInput); eVehicleColor carColor = (eVehicleColor)parseMenuOption(userInput); io_Car.Color = carColor; }
public Car(List<object> i_InputParamsFromUser) : base(i_InputParamsFromUser, k_AmountOfTires, k_CarWheelsMaximalAirPressure) { this.r_CarColor = (eCarColor)i_InputParamsFromUser[4]; this.r_AmountOfDoors = (eAmountOfDoors)i_InputParamsFromUser[5]; }
private void getNumberOfDoors() { bool isValidNumberOfDoors = true; do { try { m_NumberOfDoorsInCar = (eAmountOfDoors)parseEnumUserInput( @"Please choose the number of doors from the menu: 1. Two 2. Three 3. Four 4. Five", typeof(eAmountOfDoors)); isValidNumberOfDoors = Enum.IsDefined(typeof(eAmountOfDoors), m_NumberOfDoorsInCar); if (!isValidNumberOfDoors) { Console.WriteLine("Invalid number of doors input"); } } catch (ArgumentException ex) { isValidNumberOfDoors = false; Console.WriteLine(ex.Message); } catch (Exception ex) { isValidNumberOfDoors = false; Console.WriteLine(ex.Message); } } while (!isValidNumberOfDoors); }
public void InsertDetailsOfNewCar( string i_InputVehicleModelName, string i_InputWheelManufacturerName, float i_InputVehicleCurrentAmountOfEnergy, float i_InputWheelCurrentAirPressure, eColor i_InputCarColor, eAmountOfDoors i_InputCarDoorsNumber) { Car newCar = m_Vehicle as Car; if (newCar != null) { newCar.ColorOfCar = i_InputCarColor; newCar.AmountOfDoorsInCar = i_InputCarDoorsNumber; insertDetailsOfNewVehicle(i_InputVehicleModelName, i_InputWheelManufacturerName, i_InputVehicleCurrentAmountOfEnergy, i_InputWheelCurrentAirPressure); } else { throw new ArgumentException("The vehicle is not a Car"); } }
internal Car(string i_LicenseNumber, eVehicleColor i_Color = eVehicleColor.White, eAmountOfDoors i_AmountOfDoors = eAmountOfDoors.Five) : base(i_LicenseNumber) { m_Color = i_Color; m_AmountOfDoors = i_AmountOfDoors; }