Beispiel #1
0
        /// <summary>
        /// Allows user to select a vehicle and fuel it
        /// </summary>
        private void putFuel()
        {
            string    licenseNumber = getLicenceNumberFromUser();
            eFuelType fuelType      = getFuelTypeFromUser();
            float     fuelAmount    = getFuelAmountFromUser();

            Vehicle fuelVehicle = null;

            if (m_Garage.GetFuelVehicles.TryGetValue(licenseNumber, out fuelVehicle))
            {
                try
                {
                    m_Garage.AddFuel(fuelVehicle, fuelAmount, fuelType);
                    write("Vehicle was successfully fueled!");
                }
                catch (ArgumentException argumentException)
                {
                    write(argumentException.ToString());
                }
            }
            else
            {
                write("No fuel vehicle listed for license number " + licenseNumber);
            }
        }