Пример #1
0
 private static void fillCarArguments(ref ArgumentConsumersContainer i_ArgumentsContainer)
 {
     string[] carColor = Enum.GetNames(typeof(Car.eCarColor));
     i_ArgumentsContainer.AddArgument(Keys.LicenseNumber, new ArgumentConsumer("Enter the License number of the car:", "License Number", null));
     i_ArgumentsContainer.AddArgument(Keys.Color, new ArgumentConsumer("Select an color:", "Color", null, carColor));
     i_ArgumentsContainer.AddArgument(Keys.NumberOfDoors, new ArgumentConsumer("Select how many doors (between 2 - 5):", "Number Of Doors", new ArgumentBounds(Car.MinimumNumberOfDoors, Car.MaximumNumberOfDoors, null)));
 }
Пример #2
0
 private static void fillMotorcycleArguments(ref ArgumentConsumersContainer i_ArgumentsContainer)
 {
     string[] licenseTypes = Enum.GetNames(typeof(Motorcycle.eLicenseType));
     i_ArgumentsContainer.AddArgument(Keys.LicenseNumber, new ArgumentConsumer("Enter the License number of the car:", "License Number", null));
     i_ArgumentsContainer.AddArgument(Keys.LicenseType, new ArgumentConsumer("Enter License type:", "License Type", null, licenseTypes));
     i_ArgumentsContainer.AddArgument(Keys.EngineVolume, new ArgumentConsumer("Enter Engine volume:", "License Type", new ArgumentBounds(0, null, null), licenseTypes));
 }
Пример #3
0
        private static ArgumentConsumersContainer getElectricMotorcycleArguments()
        {
            ArgumentConsumersContainer argumentContainer = new ArgumentConsumersContainer();

            argumentContainer.AddArgument(Keys.RemainingCharge, new ArgumentConsumer("Enter remaining charge:", "Remaining Charge", new ArgumentBounds(0, null, EngineCapacityConstant.ElectricMotorcycleEngineCapacity)));
            fillMotorcycleArguments(ref argumentContainer);
            addTireArguments(ref argumentContainer, Motorcycle.GetNumberOfTires, 28f);
            return(argumentContainer);
        }
Пример #4
0
        private static Motorcycle getElectricMotorcycle(ArgumentConsumersContainer i_VehicleArgumentConsumersContainer)
        {
            Dictionary <string, ArgumentConsumer> motorcycleArguments = i_VehicleArgumentConsumersContainer.GetConsumers;
            float      remainingCharge = float.Parse(motorcycleArguments[Keys.RemainingCharge].ValueFromUser);
            Engine     engine          = new ElectricEngine(remainingCharge, EngineCapacityConstant.ElectricMotorcycleEngineCapacity);
            Motorcycle motorcycle      = getMotorcycle(motorcycleArguments, engine);

            return(motorcycle);
        }
Пример #5
0
        private static Car getElectricCar(ArgumentConsumersContainer i_VehicleArgumentConsumersContainer)
        {
            Dictionary <string, ArgumentConsumer> carArguments = i_VehicleArgumentConsumersContainer.GetConsumers;
            float  remainingFuel = float.Parse(carArguments[Keys.RemainingCharge].ValueFromUser);
            Engine engine        = new ElectricEngine(remainingFuel, EngineCapacityConstant.ElectricCarEngineCapacity);
            Car    car           = getCar(carArguments, engine);

            return(car);
        }
Пример #6
0
        private static ArgumentConsumersContainer getFueledCarArguments()
        {
            ArgumentConsumersContainer argumentContainer = new ArgumentConsumersContainer();

            argumentContainer.AddArgument(Keys.RemainingFuel, new ArgumentConsumer("Enter remaining fuel:", "Remaining Energy", new ArgumentBounds(0, null, EngineCapacityConstant.ElectricCarEngineCapacity)));
            fillCarArguments(ref argumentContainer);
            addTireArguments(ref argumentContainer, Car.GetNumberOfTires, 30f);

            return(argumentContainer);
        }
Пример #7
0
        private static Truck getTruck(ArgumentConsumersContainer i_VehicleArgumentConsumersContainer)
        {
            Dictionary <string, ArgumentConsumer> truckArguments = i_VehicleArgumentConsumersContainer.GetConsumers;
            float remainingFuel = float.Parse(truckArguments[Keys.RemainingFuel].ValueFromUser);

            FueledEngine.eFuelType fuelType = FueledEngine.eFuelType.Soler;
            Engine engine = new FueledEngine(remainingFuel, EngineCapacityConstant.FueledTruckEngineCapacity, fuelType);
            Truck  truck  = getTruck(truckArguments, engine);

            return(truck);
        }
Пример #8
0
        private static Motorcycle getMotorcycle(ArgumentConsumersContainer i_VehicleArgumentConsumersContainer)
        {
            Dictionary <string, ArgumentConsumer> motorcycleArguments = i_VehicleArgumentConsumersContainer.GetConsumers;
            float remainingFuel = float.Parse(motorcycleArguments[Keys.RemainingFuel].ValueFromUser);

            FueledEngine.eFuelType fuelType = FueledEngine.eFuelType.Octan95;
            Engine     engine     = new FueledEngine(remainingFuel, EngineCapacityConstant.ElectricMotorcycleEngineCapacity, fuelType);
            Motorcycle motorcycle = getMotorcycle(motorcycleArguments, engine);

            return(motorcycle);
        }
Пример #9
0
        private static Car getFueledCar(ArgumentConsumersContainer i_VehicleArgumentConsumersContainer)
        {
            Dictionary <string, ArgumentConsumer> carArguments = i_VehicleArgumentConsumersContainer.GetConsumers;
            float remainingFuel = float.Parse(carArguments[Keys.RemainingFuel].ValueFromUser);

            FueledEngine.eFuelType fuelType = FueledEngine.eFuelType.Octan96;
            Engine engine = new FueledEngine(remainingFuel, EngineCapacityConstant.FueledCarEngineCapacity, fuelType);
            Car    car    = getCar(carArguments, engine);

            return(car);
        }
Пример #10
0
        private static ArgumentConsumersContainer getTruckArguments()
        {
            ArgumentConsumersContainer argumentContainer = new ArgumentConsumersContainer();

            argumentContainer.AddArgument(Keys.LicenseNumber, new ArgumentConsumer("Enter the License number of the car:", "License Number", null));
            argumentContainer.AddArgument(Keys.HazardousCargo, new ArgumentConsumer("Enter Y/N for hazardous cargo", "Hazardous Cargo", null));
            argumentContainer.AddArgument(Keys.CargoVolume, new ArgumentConsumer("Enter Cargo Volume:", "Cargo Volume", null));
            argumentContainer.AddArgument(Keys.RemainingFuel, new ArgumentConsumer("Enter remaining fuel:", "Remaining Fuel", new ArgumentBounds(0, null, EngineCapacityConstant.FueledTruckEngineCapacity)));
            addTireArguments(ref argumentContainer, Truck.GetNumberOfTires, 26f);

            return(argumentContainer);
        }
Пример #11
0
 private static void addTireArguments(ref ArgumentConsumersContainer i_ArgumentContainer, int i_HowManyArguments, float i_MaxAirPressure)
 {
     for (int i = 1; i <= i_HowManyArguments; i++)
     {
         i_ArgumentContainer.AddArgument(
             string.Format(Keys.TireAirPressure, i),
             new ArgumentConsumer("Enter air pressure", "Air Pressure", new ArgumentBounds(0, null, i_MaxAirPressure)));
         i_ArgumentContainer.AddArgument(
             string.Format(Keys.TireManufacturer, i),
             new ArgumentConsumer("Enter Manufacturer", "Manufacturer", null));
     }
 }
Пример #12
0
        public static Vehicle GetVehicle(eVehicleType i_VehicleType, ArgumentConsumersContainer i_VehicleArgumentConsumersContainer)
        {
            switch (i_VehicleType)
            {
            case eVehicleType.Car:
                return(getFueledCar(i_VehicleArgumentConsumersContainer));

            case eVehicleType.Motorcycle:
                return(getMotorcycle(i_VehicleArgumentConsumersContainer));

            case eVehicleType.ElectricCar:
                return(getElectricCar(i_VehicleArgumentConsumersContainer));

            case eVehicleType.ElectricMotorcycle:
                return(getElectricMotorcycle(i_VehicleArgumentConsumersContainer));

            case eVehicleType.Truck:
                return(getTruck(i_VehicleArgumentConsumersContainer));

            default:
                return(null);
            }
        }