private void putNewVehicleInGarage()
        {
            VehicleInGarage vehiclesInGarage       = getDetailsOfVehicleInGarage();
            string          modelName              = inputModleName();
            string          licenseNumber          = inputLicenseNumber();
            float           percentageOfEnergyLeft = inputPercentageOfEnergyLeft();
            eVehicleWheels  WheelsByVehicleType    = inputGeneralTypeOfVehicle();
            List <Wheel>    wheels = inputListOfWheels(WheelsByVehicleType);

            switch (WheelsByVehicleType)
            {
            case eVehicleWheels.motorcycle:
                putNewMotorcycleInGarage(licenseNumber, modelName, percentageOfEnergyLeft, vehiclesInGarage, wheels);
                break;

            case eVehicleWheels.car:
                putNewCarInGarage(licenseNumber, modelName, percentageOfEnergyLeft, vehiclesInGarage, wheels);
                break;

            case eVehicleWheels.truck:
                putNewTruckInGarage(licenseNumber, modelName, percentageOfEnergyLeft, vehiclesInGarage, wheels);
                break;

            default:
                Console.WriteLine("We do not handle this type of vehicle");
                break;
            }
        }
Beispiel #2
0
 public void InitializeWheels(float i_MaxAirPressure, eVehicleWheels i_NumOfWheels)
 {
     m_Wheels = new Wheel[(int)i_NumOfWheels];
     for (int i = 0; i < (int)i_NumOfWheels; i++)
     {
         m_Wheels[i] = new Wheel(i_MaxAirPressure);
     }
 }
Beispiel #3
0
        public void InitializeWheels(float i_MaxAirPressure, eVehicleWheels i_NumOfWheels)
        {
            m_Wheels = new Wheel[(int)i_NumOfWheels];
            for (int i = 0; i < (int)i_NumOfWheels; i++)
            {
                m_Wheels[i] = new Wheel();
            }

            foreach (Wheel wheel in m_Wheels)
            {
                wheel.MaxAirPressure = i_MaxAirPressure;
            }
        }
        private List <Wheel> inputListOfWheels(eVehicleWheels i_WheelsByVehicleType)
        {
            List <Wheel> wheels = new List <Wheel>();
            Wheel        currentWheel;
            float        maxAirPressure = findMaxAirPressureByVehicleType(i_WheelsByVehicleType);

            Console.WriteLine("Please enter the weels details");

            for (int i = 0; i < (int)i_WheelsByVehicleType; i++)
            {
                currentWheel = createNewWheel(maxAirPressure);
                wheels.Add(currentWheel);
            }

            return(wheels);
        }
        private float findMaxAirPressureByVehicleType(eVehicleWheels i_WheelsByVehicleType)
        {
            float maxAirPressure = 0;

            switch (i_WheelsByVehicleType)
            {
            case eVehicleWheels.motorcycle:
                maxAirPressure = Motorcycle.k_WeelMaxAirPressure;
                break;

            case eVehicleWheels.car:
                maxAirPressure = Car.k_WeelMaxAirPressure;
                break;

            case eVehicleWheels.truck:
                maxAirPressure = Truck.k_WeelMaxAirPressure;
                break;
            }

            return(maxAirPressure);
        }