示例#1
0
        public void RefuelVehicle(string i_LicenseNumber, FuelBasedEngine.eFuelType i_FuelType, float i_AmountToRefuel)
        {
            Vehicle vehicle;
            bool    isInGarage = GetVehicle(i_LicenseNumber, out vehicle);

            if (!isInGarage)
            {
                throw new System.ArgumentException(k_VehicleDoesntExist);
            }

            FuelBasedEngine engine = vehicle.Engine as FuelBasedEngine;

            if (engine != null)
            {
                engine.Refuel(i_AmountToRefuel, i_FuelType);
                m_GarageVehicles[i_LicenseNumber] = vehicle;
            }
            else
            {
                throw new FormatException("Not Fuel Based Vehicle");
            }
        }
示例#2
0
        /*** Constructor ***/

        public FuelBasedMotorcycle(string i_LicenceNumber, string i_OwnerName, string i_OwnerPhoneNumber, string i_ModelName)
            : base(i_LicenceNumber, i_OwnerName, i_OwnerPhoneNumber, i_ModelName)
        {
            Engine = new FuelBasedEngine(0.0f, k_MaxAmountOfFuelForMotorcycle, k_FuelTypeForMotorcycle);
        }
示例#3
0
        /*** Constructor ***/

        public FuelBasedTruck(string i_LicenceNumber, string i_OwnerName, string i_OwnerPhoneNumber, string i_ModelName)
            : base(i_LicenceNumber, i_OwnerName, i_OwnerPhoneNumber, i_ModelName)
        {
            Engine = new FuelBasedEngine(0.0f, k_MaxAmountOfFuelForTruck, k_FuelTypeForTruck);
        }