public void CreateMotorCycle(object[] GeneralParamsOfVehicle, eMotorCycleLicences i_MotorCycleLicence, int i_EngineValume, ref List <Wheel> i_Wheels, bool i_IsElectronic) { Vehicle newVehicle; newVehicle = new MotorCycle((string)GeneralParamsOfVehicle[4], (string)GeneralParamsOfVehicle[0], i_EngineValume, i_MotorCycleLicence, (float)GeneralParamsOfVehicle[5], ref i_Wheels, i_IsElectronic); m_DictionaryVehicles.Add((string)GeneralParamsOfVehicle[0], new VehicleDetails((string)GeneralParamsOfVehicle[1], (string)GeneralParamsOfVehicle[2], ref newVehicle)); }
public void CreatMotorCycle(object[] GeneralParamsOfVehicle, string i_PlateNumber) { List <Wheel> wheels; eMotorCycleLicences motorCycleLicences = 0; int engineVolume = 0; string inputString; bool isElectronic = false; wheels = CreateWheels(GarageManeger.ConstantsNumberOfWeels.MotorCycle, GarageManeger.ConstantsWeelsMaxPressures.MotorCycle); System.Console.WriteLine("Please Insert the Licence Of The MotorCycle: [A(1) /A1(2) /B1(3) /B2(4)]"); inputString = System.Console.ReadLine(); while (!IV.ValidInputLicenceMotorCycle(inputString, ref motorCycleLicences)) { inputString = System.Console.ReadLine(); } System.Console.WriteLine("Please Insert Engine Volume Of The MotorCycle: "); inputString = System.Console.ReadLine(); while (!IV.ValidInputIntegerNonNegative(inputString, ref engineVolume)) { inputString = System.Console.ReadLine(); } if ((eKindsOfVehicles)GeneralParamsOfVehicle[3] == eKindsOfVehicles.ElectronicMotorCycle) { isElectronic = true; } GM.CreateMotorCycle(GeneralParamsOfVehicle, motorCycleLicences, engineVolume, ref wheels, isElectronic); System.Console.WriteLine("Motor Cycle Entered Successfully!"); }
public MotorCycle(string i_Model, string i_PlateNumber, int i_EngineValume, eMotorCycleLicences i_MotorCycleLicences, float i_CurrentCapacityEnergy, ref List <Wheel> io_Wheels, bool i_IsElectronic) : base(i_Model, i_PlateNumber, ref io_Wheels) { m_EngineValume = i_EngineValume; m_KingOfLicence = i_MotorCycleLicences; if (i_IsElectronic) { m_EnergySource = new Electronic(1.8f, i_CurrentCapacityEnergy); } else { m_EnergySource = new Fuel(eFuelKinds.Octan96, 6f, i_CurrentCapacityEnergy); } }
internal bool ValidInputLicenceMotorCycle(string i_InputString, ref eMotorCycleLicences motorCycleLicences) { bool isValid = false; try { if (i_InputString == "A" || i_InputString == "1") { motorCycleLicences = GarageLogic.eMotorCycleLicences.A; isValid = true; } else if (i_InputString == "A1" || i_InputString == "2") { motorCycleLicences = GarageLogic.eMotorCycleLicences.A1; isValid = true; } else if (i_InputString == "B1" || i_InputString == "3") { motorCycleLicences = GarageLogic.eMotorCycleLicences.B1; isValid = true; } else if (i_InputString == "B2" || i_InputString == "4") { motorCycleLicences = GarageLogic.eMotorCycleLicences.B2; isValid = true; } else { throw new ArgumentException(); } } catch (ArgumentException) { Console.WriteLine("{0} is Not an Options. Please Try Again: [A(1) /A1(2) /B1(3) /B2(4)] ", i_InputString); } return(isValid); }