Esempio n. 1
0
        public void FuelVehicle()
        {
            Console.WriteLine("Enter vehicle registration number:");
            string userRegistrationNumber = Console.ReadLine();

            Console.WriteLine("Please Enter the fuel type");
            PrintEnum(ENumType.eFuelType.Octan95);
            string userFuelChoice = Console.ReadLine();

            ENumType.eFuelType typeToAdd = (ENumType.eFuelType)Enum.Parse(typeof(ENumType.eFuelType),
                                                                          userFuelChoice, true);
            Console.WriteLine("Enter amount:");
            float AmountToAdd = float.Parse(Console.ReadLine());

            DataBase.FuelVehicle(userRegistrationNumber, typeToAdd, AmountToAdd);
        }
Esempio n. 2
0
        public static void FuelVehicle(string i_RegistrationNumber, ENumType.eFuelType i_TypeOfFuel, float i_ToAdd)
        {
            bool vehicleIsFound = false;

            foreach (VehicleBase vehicle in vehicleList)
            {
                if (vehicle.r_RegistrationNumber == i_RegistrationNumber)
                {
                    vehicle.FillEnergySource(i_TypeOfFuel, i_ToAdd);
                    vehicleIsFound = true;
                }
            }
            if (!vehicleIsFound)
            {
                throw new System.Exception("Vehicle not found");
            }
        }
Esempio n. 3
0
        void CheckAndCreateEngineType(ENumType.eEnergytype i_EngineType, ENumType.eFuelType i_FuelType)
        {
            switch (i_EngineType)
            {
            case ENumType.eEnergytype.Gasoline:
            {
                m_MyEngine = new GasolineEngine(m_EnergyPercentage, r_MaxEnergyCapacity, i_FuelType);
                break;
            }

            case ENumType.eEnergytype.Elecrtic:
            {
                m_MyEngine = new ElectricEngine(m_EnergyPercentage, r_MaxEnergyCapacity);
                break;
            }
            }
        }
Esempio n. 4
0
 public GasolineEngine(float i_CurrentAmount, float i_MaximumAmount, ENumType.eFuelType i_CurrentGasolineType)
 {
     m_CurrentAmount       = i_CurrentAmount;
     m_MaximumAmount       = i_MaximumAmount;
     m_CurrentGasolineType = i_CurrentGasolineType;
 }