private void chargeAnElectricVehicle()
        {
            string licenseNumber           = inputLicenseNumber();
            float  numberOfMinutesToCharge = inputNumberOfMinutesToCharge();

            m_Garage.ChargeElectricVehicle(licenseNumber, numberOfMinutesToCharge);
        }
Beispiel #2
0
        private static void chargeElectricVehicle()
        {
            string licensePlateNumber            = Utils.GetLicensePlateNumber();
            string electricityMinutesToAddString = Utils.GetElectricityAmountToAdd();
            float  electricityMinutesToAdd;

            if (!float.TryParse(electricityMinutesToAddString, out electricityMinutesToAdd))
            {
                throw new FormatException("Error: Expected a float type for electricity number of minutes to add");
            }

            float electricityHoursToAdd = electricityMinutesToAdd / 60.0f;

            m_Garage.ChargeElectricVehicle(licensePlateNumber, electricityHoursToAdd);
            Console.WriteLine("The Vehicle's Battery was successfully added with {0} Working Minutes.", electricityMinutesToAdd);
        }