Exemple #1
0
 public MotorcycleThatOperatesOnFuel(string i_NameOfModel, string i_NumberOfLicense, string i_NameOfWheelManufacturer,
                                     float i_RemainingAmountOfFuelInTheTank,
                                     Motorcycle.eTypeOfLicense i_License, int i_CapacityOfEngine)
     : base(i_NameOfModel, i_NumberOfLicense, k_NumberOfWheels, i_NameOfWheelManufacturer, k_MaximumWheelAirPressure, k_TypeOfFuel, i_RemainingAmountOfFuelInTheTank, k_CapacityOfTank)
 {
     m_motorcycle = new Motorcycle(i_License, i_CapacityOfEngine);
 }
Exemple #2
0
 public ElectricMotorcycle(string i_NameOfModel, string i_NumberOfLicense, string i_NameOfWheelManufacturer,
                           float i_RemainingNumberOfHoursForLifeTimeOfBattery,
                           Motorcycle.eTypeOfLicense i_license, int i_CapacityOfEngine)
     : base(i_NameOfModel, i_NumberOfLicense, k_NumberOfWheels, i_NameOfWheelManufacturer, k_MaximumWheelAirPressure, i_RemainingNumberOfHoursForLifeTimeOfBattery, k_MaximumNumberOfHoursForLifeOfBattery)
 {
     m_motorcycle = new Motorcycle(i_license, i_CapacityOfEngine);
 }
Exemple #3
0
        internal Motorcycle(Motorcycle.eTypeOfLicense i_license, int i_CapacityOfEngine)
        {
            if (i_CapacityOfEngine <= 0)
            {
                throw new ArgumentIsNotPositiveNumberException("i_CapacityOfEngine", i_CapacityOfEngine);
            }

            m_license          = i_license;
            m_CapacityOfEngine = i_CapacityOfEngine;
        }
Exemple #4
0
        public ElectricMotorcycle(string i_NameOfModel, string i_NumberOfLicense, string i_NameOfWheelManufacturer, float[] i_WheelsAirPressures,
                                  Motorcycle.eTypeOfLicense i_license, int i_CapacityOfEngine)
            : base(i_NameOfModel, i_NumberOfLicense, i_WheelsAirPressures, i_NameOfWheelManufacturer, k_MaximumWheelAirPressure, k_MaximumNumberOfHoursForLifeOfBattery)
        {
            if (i_WheelsAirPressures.Length != k_NumberOfWheels)
            {
                throw new ArgumentException("i_WheelsAirPressures.Length must be equal to " + k_NumberOfWheels + '.', "i_WheelsAirPressures.Length");
            }

            m_motorcycle = new Motorcycle(i_license, i_CapacityOfEngine);
        }
Exemple #5
0
        public MotorcycleThatOperatesOnFuel(string i_NameOfModel, string i_NumberOfLicense, string i_NameOfWheelManufacturer, float[] i_WheelsAirPressures,
                                            Motorcycle.eTypeOfLicense i_License, int i_CapacityOfEngine)
            : base(i_NameOfModel, i_NumberOfLicense, i_WheelsAirPressures, i_NameOfWheelManufacturer, k_MaximumWheelAirPressure, k_TypeOfFuel, k_CapacityOfTank)
        {
            if (i_WheelsAirPressures.Length != k_NumberOfWheels)
            {
                throw new ArgumentException("i_WheelsAirPressures.Length must be equal to " + k_NumberOfWheels + '.', "i_WheelsAirPressures.Length");
            }

            m_motorcycle = new Motorcycle(i_License, i_CapacityOfEngine);
        }
Exemple #6
0
        public static void MotorcyclePropertise(Vehicle i_Moto, int i_EngineCapacity, Motorcycle.eTypeOfLicense typeOfLicense)
        {
            Motorcycle motorcycle = i_Moto as Motorcycle;

            if (motorcycle != null)
            {
                motorcycle.EngineCapacity = i_EngineCapacity;
                motorcycle.TypeOfLicense  = typeOfLicense;
            }
            else
            {
                throw new Exception(); // to change
            }
        }
Exemple #7
0
        public static Motorcycle createMotorcycle(Motorcycle.eTypeOfLicense i_TypeOfLicense, int i_EngineCapacity)
        {
            Motorcycle newMotorcycle = new Motorcycle(i_TypeOfLicense, i_EngineCapacity);

            return(newMotorcycle);
        }
Exemple #8
0
 public Motorcycle.eTypeOfLicense getTypeOfLicense()
 {
     Motorcycle.eTypeOfLicense typeOfLicense = (Motorcycle.eTypeOfLicense)getValidInt(MOTORCYCLE_LICENSE_TYPE, 1, 4);
     return(typeOfLicense);
 }
Exemple #9
0
        private void addNewVehicleToGarage()
        {
            string licensePlate   = m_UserInputs.getLicensePlate();
            float  maxAirPressure = 0;
            float  maxBatteryTime = 0;

            FuelVehicle.eFuelType fuelType;
            Vehicle.eTireAmount   tireAmount;

            if (m_Garage.m_AllVehiclesInTheGarage.ContainsKey(licensePlate))
            {
                m_Garage.changeVehicleStatus(licensePlate, Client.eVehicleStatus.Repairing);
                m_UserInputs.vehicleAlreadyInGarageMessage();
            }
            else
            {
                string vehicleModel             = m_UserInputs.getValidString("Please enter vehicle model name:");
                string ownerName                = m_UserInputs.getValidString("Please enter Owner Name");
                string ownerPhone               = m_UserInputs.getOwnerPhone();
                float  percentOfRemainingEnergy = 0;
                Client newClient                = null;

                CreateVehicle.eVehicleType vehicleType = (CreateVehicle.eVehicleType)m_UserInputs.getVehicleType();

                string      tiresManufacturer = m_UserInputs.getValidString("Please enter the tires manufacturer:");
                float       currentTireAirPressure;
                List <Tire> listOfTires;
                Vehicle     vehicleForProperty;

                if (vehicleType == CreateVehicle.eVehicleType.ElectricCar || vehicleType == CreateVehicle.eVehicleType.FuelCar)
                {
                    maxAirPressure         = (float)Tire.eMaxAirPressure.Car;
                    currentTireAirPressure = m_UserInputs.getTiresPressure(maxAirPressure);
                    tireAmount             = Vehicle.eTireAmount.Car;
                    listOfTires            = CreateVehicle.createListOfTires(tireAmount, tiresManufacturer, currentTireAirPressure, maxAirPressure);
                    Car.eColor         carColor      = m_UserInputs.getCarColor();
                    Car.eNumberOfDoors numberOfDoors = m_UserInputs.getNumberOfDoors();
                    Car car = CreateVehicle.createCar(carColor, numberOfDoors);

                    if (vehicleType == CreateVehicle.eVehicleType.ElectricCar)
                    {
                        float remainingBatteryTime = m_UserInputs.getRemainingBatteryTime(ElectricCar.k_MaxBatteryTime);
                        percentOfRemainingEnergy = Vehicle.getPercentOfEnergy(remainingBatteryTime, ElectricCar.k_MaxBatteryTime);
                        ElectricCar electricCar = CreateVehicle.createElectricCar(car, remainingBatteryTime, maxBatteryTime, vehicleModel, licensePlate, percentOfRemainingEnergy, listOfTires);
                        newClient = CreateVehicle.createClient(ownerName, ownerPhone, Client.eVehicleStatus.Repairing, electricCar);
                    }
                    else
                    {
                        fuelType = FuelVehicle.eFuelType.Octan98;
                        float currentAmountOfFuel = m_UserInputs.getCurrentAmountOfFuel(FuelCar.k_MaxAmountOfFuel);
                        percentOfRemainingEnergy = Vehicle.getPercentOfEnergy(currentAmountOfFuel, FuelCar.k_MaxAmountOfFuel);
                        FuelCar fuelCar = CreateVehicle.createFuelCar(car, fuelType, currentAmountOfFuel, vehicleModel, licensePlate, percentOfRemainingEnergy, listOfTires);
                        newClient = CreateVehicle.createClient(ownerName, ownerPhone, Client.eVehicleStatus.Repairing, fuelCar);
                    }

                    vehicleForProperty = newClient.m_Vehicle;
                    Car.setProperties(vehicleForProperty, carColor, numberOfDoors);
                }
                else if (vehicleType == CreateVehicle.eVehicleType.ElectricMotorcycle || vehicleType == CreateVehicle.eVehicleType.FuelMotorcycle)
                {
                    maxAirPressure         = (float)Tire.eMaxAirPressure.Motorcycle;
                    currentTireAirPressure = m_UserInputs.getTiresPressure(maxAirPressure);
                    tireAmount             = Vehicle.eTireAmount.Motorcycle;
                    listOfTires            = CreateVehicle.createListOfTires(tireAmount, tiresManufacturer, currentTireAirPressure, maxAirPressure);
                    Motorcycle.eTypeOfLicense typeOfLicense = m_UserInputs.getTypeOfLicense();
                    int        engineCapacity = m_UserInputs.getValidInt("Please enter engine capacity:", 0, int.MaxValue);
                    Motorcycle motorCycle     = CreateVehicle.createMotorcycle(typeOfLicense, engineCapacity);

                    if (vehicleType == CreateVehicle.eVehicleType.ElectricMotorcycle)
                    {
                        float remainingBatteryTime = m_UserInputs.getRemainingBatteryTime(ElectricMotorcycle.k_MaxBatteryTime);
                        percentOfRemainingEnergy = Vehicle.getPercentOfEnergy(remainingBatteryTime, ElectricMotorcycle.k_MaxBatteryTime);
                        ElectricMotorcycle electricMotorcycle = CreateVehicle.createElectricMotorcycle(motorCycle, remainingBatteryTime, vehicleModel, licensePlate, percentOfRemainingEnergy, listOfTires);
                        newClient = CreateVehicle.createClient(ownerName, ownerPhone, Client.eVehicleStatus.Repairing, electricMotorcycle);
                    }
                    else
                    {
                        fuelType = FuelVehicle.eFuelType.Octan95;
                        float currentAmountOfFuel = m_UserInputs.getCurrentAmountOfFuel(FuelMotorcycle.k_MaxAmountOfFuel);
                        percentOfRemainingEnergy = Vehicle.getPercentOfEnergy(currentAmountOfFuel, FuelMotorcycle.k_MaxAmountOfFuel);
                        FuelMotorcycle fuelMotorcycle = CreateVehicle.createFuelMotorcycle(motorCycle, fuelType, currentAmountOfFuel, vehicleModel, licensePlate, percentOfRemainingEnergy, listOfTires);
                        newClient = CreateVehicle.createClient(ownerName, ownerPhone, Client.eVehicleStatus.Repairing, fuelMotorcycle);
                    }

                    vehicleForProperty = newClient.m_Vehicle;
                    Motorcycle.setProperties(vehicleForProperty, typeOfLicense, engineCapacity);
                }
                else if (vehicleType == CreateVehicle.eVehicleType.Truck)
                {
                    maxAirPressure         = (float)Tire.eMaxAirPressure.Truck;
                    currentTireAirPressure = m_UserInputs.getTiresPressure(maxAirPressure);
                    tireAmount             = Vehicle.eTireAmount.Truck;
                    listOfTires            = CreateVehicle.createListOfTires(tireAmount, tiresManufacturer, currentTireAirPressure, maxAirPressure);
                    fuelType = FuelVehicle.eFuelType.Soler;
                    bool  carrierDangerousMaterials = m_UserInputs.getIfCarrierDangerousMaterials();
                    float maximumCarryingWeight     = m_UserInputs.getValidFloat("Please enter maximum carry weight:", 0, int.MaxValue);
                    Truck truck = CreateVehicle.createTruck(carrierDangerousMaterials, maximumCarryingWeight);
                    float currentAmountOfFuel = m_UserInputs.getCurrentAmountOfFuel(FuelTruck.k_MaxAmountOfFuel);
                    percentOfRemainingEnergy = Vehicle.getPercentOfEnergy(currentAmountOfFuel, FuelTruck.k_MaxAmountOfFuel);
                    FuelTruck fuelTruck = CreateVehicle.createFuelTruck(truck, fuelType, currentAmountOfFuel, vehicleModel, licensePlate, percentOfRemainingEnergy, listOfTires);
                    newClient          = CreateVehicle.createClient(ownerName, ownerPhone, Client.eVehicleStatus.Repairing, fuelTruck);
                    vehicleForProperty = newClient.m_Vehicle;
                    Truck.setProperties(vehicleForProperty, carrierDangerousMaterials, maximumCarryingWeight);
                }

                m_Garage.addVehicle(newClient);
                m_UserInputs.suceededToAddMessage();
            }

            System.Console.ReadLine();
        }