private static void checkLicenseType(string i_licenseTypeStringFormat, ref Motorcycle.LicenseType io_LicenseType) { if (i_licenseTypeStringFormat != "1" && i_licenseTypeStringFormat != "2" && i_licenseTypeStringFormat != "3" && i_licenseTypeStringFormat != "4") { throw new FormatException("Bad Input Chose one Number From (1-4)"); } io_LicenseType = (Motorcycle.LicenseType) int.Parse(i_licenseTypeStringFormat); }
private static Motorcycle.LicenseType getLicenseType() { Motorcycle.LicenseType licenseType = 0; licenseTypeLabel(); licenseTypeInstructionMessage(); licenseTypeInputMessage(); string licenseTypeStringFormat = Console.ReadLine(); try { checkLicenseType(licenseTypeStringFormat, ref licenseType); } catch (FormatException ex) { Console.WriteLine(ex.Message); licenseType = getLicenseType(); } return(licenseType); }
public static Motorcycle CreateNewMotorcycle( ref Client i_Owner, Vehicle.VehicleType i_Type, string i_ModelName, string i_LicenseNumber, ref EnergySystem i_EnergySystem, short i_WheelsNumber, ref List <Wheel> i_Wheels, int i_EngineCapacity, Motorcycle.LicenseType i_LicenseType) { return(new Motorcycle( ref i_Owner, i_Type, i_ModelName, i_LicenseNumber, ref i_EnergySystem, i_WheelsNumber, ref i_Wheels, i_EngineCapacity, i_LicenseType)); }