private void addFuel() { string licensePlate = getLicensePlate(); if (m_Garage.IsVehicleExists(licensePlate)) { eFuelType fuelType = getFuelType(); Console.WriteLine("Amount of fuel to add:"); float amountOfFuelToAdd = float.Parse(Console.ReadLine()); try { m_Garage.AddFuelToVehicle(licensePlate, fuelType, amountOfFuelToAdd); Console.WriteLine("Fuel was added successfully!"); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine("Fuel was not added!"); } } else { Console.WriteLine("License plate was not found. Could not finish add fuel operation."); } }
private void addFuelToVehicle() { string plateNumber = getLicensePlateNumber(); float fuelAmount = getFuelAmount(); FuelVehicle.eFuelType typeOfFuel = getFuelType(); try { r_Garage.AddFuelToVehicle(plateNumber, fuelAmount, typeOfFuel); } catch (ValueOutOfRangeException valueOutOfRange) { Console.WriteLine(valueOutOfRange.Message); } catch (ArgumentException logicError) { Console.WriteLine(logicError.Message); } }