コード例 #1
0
 //-------------------------------------------------------------------------//
 //                             Pubilc Methods                              //
 //-------------------------------------------------------------------------//
 public void EnterVehicleIntoGarage(string i_ModelName, string i_LicenceNumber, List <string> i_WheelInfo, float i_EnergyLeftPercent, eVehicleType i_VehicleType, object i_InnerVehicleInfo)
 {
     if (m_Vechile == null)
     {
         m_Vechile = VehicleMaker.CreateVehicle(i_ModelName, i_LicenceNumber, i_WheelInfo, i_EnergyLeftPercent, i_VehicleType, i_InnerVehicleInfo);
     }
     else
     {
         throw new ArgumentException("Vehicle already in garage");
     }
 }
コード例 #2
0
        /*The system will supply the user with the following functions:
         *
         * 1. “Insert” a new vehicle into the garage. The user will be asked to select a
         * vehicle type out of the supported vehicle types, and to input the license
         * number of the vehicle. If the vehicle is already in the garage (based on
         * license number) the system will display an appropriate message and will use
         * the vehicle in the garage (and will change the vehicle status to “In Repair”), if
         * not, a new object of that vehicle type will be created and the user will be
         * prompted to input the values for the properties of his vehicle, according to the
         * type of vehicle he wishes to add. */
        public void AddNewVehicle(eVehicleType i_VehicleType, List <object> i_Values)
        {
            Vehicle newVehicle = VehicleMaker.MakeVehicle(i_VehicleType, i_Values);

            m_GarageVehicles.Add(newVehicle, new VehicleInfo(i_Values[2].ToString(), i_Values[3].ToString()));
        }