Example #1
0
        public void InflateWheelsToMaxPressure(string i_LicenseNumber)
        {
            VehiclesInTheGarage currentVehicleInTheGarage = null;

            if (m_VehiclesInTheGarage.TryGetValue(i_LicenseNumber, out currentVehicleInTheGarage))
            {
                currentVehicleInTheGarage.Vehicle.InflateToMax();
            }
            else
            {
                throw new ArgumentException("There was an error, please try again.");
            }
        }
Example #2
0
        public void ChangeVehicleStatus(string i_LicenseNumber, Vehicle.eStatusOfVehicle i_NewVehicleStatus)
        {
            VehiclesInTheGarage currentVehicleInTheGarage = null;

            if (m_VehiclesInTheGarage.TryGetValue(i_LicenseNumber, out currentVehicleInTheGarage))
            {
                currentVehicleInTheGarage.VehicleStatus = i_NewVehicleStatus;
            }
            else
            {
                throw new ArgumentException("The vehicle is not in the garage.");
            }
        }
Example #3
0
        public string GetAllVehicleDetails(string i_LicenseNumber)
        {
            VehiclesInTheGarage vehicleEntered = null;
            string resultStr = null;

            if (m_VehiclesInTheGarage.TryGetValue(i_LicenseNumber, out vehicleEntered))
            {
                resultStr = vehicleEntered.ToString();
            }
            else
            {
                throw new ArgumentException("The vehicle is not in the garage.");
            }

            return(resultStr);
        }
Example #4
0
        public void VehicleGasRefule(string i_LicenseNumber, Vehicle.eGasTypes i_GasType, float i_GasAmount)
        {
            VehiclesInTheGarage currentVehicleInTheGarage = null;

            if (m_VehiclesInTheGarage.TryGetValue(i_LicenseNumber, out currentVehicleInTheGarage))
            {
                GasEngine gasVehicle = currentVehicleInTheGarage.Vehicle.Engine as GasEngine;

                if (gasVehicle != null)
                {
                    gasVehicle.Refuel(i_GasAmount, i_GasType);
                }
                else
                {
                    throw new ArgumentException("This vehicle needs a different fuel type.");
                }
            }
            else
            {
                throw new ArgumentException("The vehicle is not in the garage.");
            }
        }
Example #5
0
        public void VehicleElectricCharge(string i_LicenseNumber, float i_AmountInMinutes)
        {
            VehiclesInTheGarage vehicleEntered = null;

            if (m_VehiclesInTheGarage.TryGetValue(i_LicenseNumber, out vehicleEntered))
            {
                ElectricEngine electricVehicle = vehicleEntered.Vehicle.Engine as ElectricEngine;
                if (electricVehicle != null)
                {
                    float power = i_AmountInMinutes / 60.0f;
                    electricVehicle.ChargingBattery(power);
                }
                else
                {
                    throw new ArgumentException("The vehicle is not in the garage.");
                }
            }
            else
            {
                throw new ArgumentException("The vehicle is not in the garage.");
            }
        }