public Motorcycle(E_LicenseType licenseType, int engineVolume, E_VehicleType vehicleType, string vehicleModel, string vehicleLicensePlate, string ownerName, string OwnerPhone, E_VehicleStateInGarage vehicleState, string wheelManufacturerName, Engine vehicleEngine) : base(vehicleType, vehicleModel, vehicleLicensePlate, ownerName, OwnerPhone, vehicleState, wheelManufacturerName, vehicleEngine) { LicenseType = licenseType; EngineVolume = engineVolume; NumOfWheels = E_NumOfWheels.Two; }
/// <summary> /// add a new bike method /// </summary> /// <param name="engineType">enum type value</param> private static void addNewBike(E_EngineType engineType) { try { E_LicenseType licenseType = Utils.Parsers.ParseLicenseType(); int engineVolume = Utils.Parsers.GetIntFromUser("Enter engine volume in cc:"); float currentAmount; string vehicleModel; string licensePlate; string ownerName; string ownerPhone; string wheelManufacturerName; Utils.Parsers.RefBasicVehicleDetails(out currentAmount, out vehicleModel, out licensePlate, out ownerName, out ownerPhone, out wheelManufacturerName); GarageLogic.GarageLogic.GarageDirectory.Add(licensePlate, VehicleFactory.CreateNewMotorcycle(currentAmount, engineType, licenseType, engineVolume, vehicleModel, licensePlate, ownerName, ownerPhone, wheelManufacturerName)); } catch (FormatException ex) { Console.WriteLine(ex.Message + "Can`t parse Motorcycle!"); } }
/// <summary> /// Template for a Motorcycle /// </summary> /// <param name="currentAmount">float value</param> /// <param name="engineType">enum value</param> /// <param name="licenseType">enum value</param> /// <param name="engineVolume">int value</param> /// <param name="vehicleModel">string value</param> /// <param name="vehicleLicensePlate">string value</param> /// <param name="ownerName">string value</param> /// <param name="ownerPhone">string value</param> /// <param name="wheelManufacturerName">string value</param> /// <returns></returns> public static Motorcycle CreateNewMotorcycle(float currentAmount, E_EngineType engineType, E_LicenseType licenseType, int engineVolume, string vehicleModel, string vehicleLicensePlate, string ownerName, string ownerPhone, string wheelManufacturerName) { ///create a new show of engine for Motorcycle Engine engine; ///switch statment to choose between two types of engine (Fuel/Electric) or invalid value exception in case of unknown value. switch (engineType) { case E_EngineType.Fuel: engine = EngineFactory.CreateNewEngine(1.6f, currentAmount); break; case E_EngineType.Electric: engine = EngineFactory.CreateNewEngine(E_FuelType.Octan95, 5.5f, currentAmount); break; default: throw new ArgumentException("Invalid Type"); } ///create the Motorcycle object itself. Motorcycle motorcycle = new Motorcycle(licenseType, engineVolume, E_VehicleType.Bike, vehicleModel, vehicleLicensePlate, ownerName, ownerPhone, E_VehicleStateInGarage.InWork, wheelManufacturerName, engine); return(motorcycle); }