private void getLicenseType(out eLicenseTypes o_LicenseType) { string input; bool parseSucceeded = false; o_LicenseType = eLicenseTypes.None; Console.Clear(); do { try { Console.WriteLine("Please insert your license type by typing one of the following options:"); MenusPrinter.PrintLicenseTypesMenu(); input = Console.ReadLine(); o_LicenseType = CustomConverter.ConvertStringToLicenseType(input); parseSucceeded = true; } catch (FormatException e) { Console.WriteLine(e.Message); parseSucceeded = false; } catch (ArgumentException e) { Console.WriteLine(e.Message); parseSucceeded = false; } }while (!parseSucceeded); }
public Motorcycle(eLicenseTypes o_LicenseType, int o_EngineVolume, EnergyType o_TypeOfEnergy, string o_ModelName, string o_LicensePlate, OwnerDetails o_MotorcycleOwner, List <Wheel> o_Wheels) : base(o_ModelName, o_LicensePlate, o_MotorcycleOwner, o_Wheels) { m_licenseType = o_LicenseType; m_engineVolume = o_EngineVolume; m_EnergyType = o_TypeOfEnergy; EnergyRatio = o_TypeOfEnergy.CalculateRatio(); }
public ElectricMotorcycle( OwnerInfo i_Owner, string i_ModelName, string i_LicenseNumber, eLicenseTypes i_LicenseType, int i_EngineCapacity) : base(i_Owner, i_ModelName, i_LicenseNumber, k_MaxBatteryCapacity, i_LicenseType, i_EngineCapacity, eEngineTypes.Electric) { }
public FuelMotorcycle( OwnerInfo i_Owner, string i_ModelName, string i_LicenseNumber, eLicenseTypes i_LicenseType, int i_EngineCapacity, eFuelTypes i_FuelType) : base(i_Owner, i_ModelName, i_LicenseNumber, k_FuelTankCapacity, i_LicenseType, i_EngineCapacity, eEngineTypes.Fuel) { r_FuelType = i_FuelType; }
public Motorcycle( OwnerInfo i_Owner, string i_ModelName, string i_LicenseNumber, float i_MaxEnergyCapacity, eLicenseTypes i_LicenseType, int i_EngineCapacity, eEngineTypes i_EngineType) : base(i_Owner, i_ModelName, i_LicenseNumber, i_MaxEnergyCapacity, k_MaxAirPressure, k_NumberOfWheels, i_EngineType) { r_LicenseType = i_LicenseType; r_EngineCapacity = i_EngineCapacity; }
public override void SetVehicleDetails(Dictionary <string, object> i_VehilceInfo) { base.SetVehicleDetails(i_VehilceInfo); m_LicenseType = (eLicenseTypes)i_VehilceInfo["LicenseType"]; m_EngineVolume = (int)i_VehilceInfo["EngineVolume"]; if (EnergyType == eEnergyTypes.Electric) { m_VehicleEnergy = new Electric((float)i_VehilceInfo["RemainingEnergy"], (float)i_VehilceInfo["MaximumEnergyCapacity"]); } else { m_VehicleEnergy = new Fuel((float)i_VehilceInfo["RemainingEnergy"], (float)i_VehilceInfo["MaximumEnergyCapacity"], (eEnergyTypes)i_VehilceInfo["EnergyType"]); } }
public void SetMotorcycleAdditionalParams(string i_LicenseNumber, int i_LicenseType, int i_EngineCapacity) { GarageVehicle garageVehicle = VehiclesInGarage[i_LicenseNumber]; eLicenseTypes licenseType = checkIfValidLicenseTypeParam(i_LicenseType); if (garageVehicle.Vehicle is ElectricMotorcycle) { ElectricMotorcycle electricMotorcycle = garageVehicle.Vehicle as ElectricMotorcycle; electricMotorcycle.MotorcycleDetails.LicenseType = licenseType; electricMotorcycle.MotorcycleDetails.EngineCapacity = i_EngineCapacity; } else if (garageVehicle.Vehicle is FuelMotorcycle) { FuelMotorcycle fuelMotorcycle = garageVehicle.Vehicle as FuelMotorcycle; fuelMotorcycle.MotorcycleDetails.LicenseType = licenseType; fuelMotorcycle.MotorcycleDetails.EngineCapacity = i_EngineCapacity; } }
public static eLicenseTypes ConvertStringToLicenseType(string i_Input) { int choice; eLicenseTypes licenseType = eLicenseTypes.None; if (!int.TryParse(i_Input, out choice)) { throw new FormatException("Invalid Input Format"); } else if (!Enum.IsDefined(typeof(eLicenseTypes), choice) || (eLicenseTypes)choice == eLicenseTypes.None) { throw new ArgumentException("Invalid LicenseType choice"); } else { licenseType = (eLicenseTypes)choice; } return(licenseType); }
public FuelMotorcycle(string i_ModelName, string i_LicenseNumber, float i_CurrentFuelQuantity, eLicenseTypes i_LicenseType, int i_EngineVolume, Wheel[] i_Wheel) : base(i_ModelName, i_LicenseNumber, k_FuelType, i_CurrentFuelQuantity, k_MaxFuelQuantity, k_NumberOfWheels, i_Wheel, k_MaxWheelAirPressure) { m_MotorcycleProperties = new MotorcycleProperties(i_LicenseType, i_EngineVolume); }
public ElectricMotorcycle(string i_ModelName, string i_LicenseNumber, float i_BatteryTimeLeftByHours, eLicenseTypes i_LicenseType, int i_EngineVolume, Wheel[] i_Wheels) : base(i_ModelName, i_LicenseNumber, i_BatteryTimeLeftByHours, k_MaxBatteryTime, k_NumberOfWheels, i_Wheels, k_MaxWheelAirPressure) { m_MotorcycleProperties = new MotorcycleProperties(i_LicenseType, i_EngineVolume); }
public static Motorcycle CreateMotorCycle(eEngineTypes i_EngineType, string i_Model, string i_LicenseNumber, int i_EngineVolume, eLicenseTypes i_LicenseType, string i_WheelManufacturer) { float energyCapacity = 0; eFuelTypes fuelType = eFuelTypes.None; float k_WheelMaxAirPressure = 30; int k_AmountOfWheels = 2; switch (i_EngineType) { case eEngineTypes.ElectricVehicle: { energyCapacity = 1.8f; break; } case eEngineTypes.FuelVehicle: { energyCapacity = 6; fuelType = eFuelTypes.Octan96; break; } } Engine newEngine = EngineFactory.CreateEngine(i_EngineType, energyCapacity, fuelType); Motorcycle newMotorCycle = new Motorcycle(newEngine, i_Model, i_LicenseNumber, i_EngineVolume); newMotorCycle.Wheels = WheelsFactory.CreateWheels(k_AmountOfWheels, k_WheelMaxAirPressure, i_WheelManufacturer); newMotorCycle.LicenseType = i_LicenseType; return(newMotorCycle); }
public MotorcycleProperties(eLicenseTypes i_LicenseType, int i_EngineVolume) { m_LicenseType = i_LicenseType; m_EngineVolume = i_EngineVolume; }
public GasMotorcycle(eLicenseTypes i_MotorcycleType, int i_EngineCapacity) : base(i_MotorcycleType, i_EngineCapacity) { }
public Motorcycle(eLicenseTypes i_MotorcycleType, int i_EngineCapacity) { m_MotorcycleType = i_MotorcycleType; m_EngineCapacity = i_EngineCapacity; }