Ejemplo n.º 1
0
        public static Vehicle CreateNewVehicle(eTypeOfVehicle i_TypeOfVehicle)
        {
            Vehicle m_Vehicle = null;
            Fuel fuelSource = null;
            ElectricBattery electricSource = null;
            switch (i_TypeOfVehicle)
            {
                case eTypeOfVehicle.ElectricCar:
                    electricSource = new ElectricBattery(1.8f);
                    m_Vehicle = new Car(electricSource);
                    m_Vehicle.SetMaxAirPressureOfWheelInListOfWheels(32);
                    break;
                case eTypeOfVehicle.ElectricMotorcycle:
                    electricSource = new ElectricBattery(1.9f);
                    m_Vehicle = new Motorcycle(electricSource);
                    m_Vehicle.SetMaxAirPressureOfWheelInListOfWheels(29);
                    break;
                case eTypeOfVehicle.FuelCar:
                    fuelSource = new Fuel(48f);
                    fuelSource.FuelType = eFuelType.Octan95;
                    m_Vehicle = new Car(fuelSource);
                    m_Vehicle.SetMaxAirPressureOfWheelInListOfWheels(32);
                    break;
                case eTypeOfVehicle.FuelMotorcycle:
                    fuelSource = new Fuel(7.5f);
                    fuelSource.FuelType = eFuelType.Octan98;
                    m_Vehicle = new Motorcycle(fuelSource);
                    m_Vehicle.SetMaxAirPressureOfWheelInListOfWheels(29);
                    break;
                case eTypeOfVehicle.Truck:
                    fuelSource = new Fuel(190f);
                    fuelSource.FuelType = eFuelType.Soler;
                    m_Vehicle = new Truck(fuelSource);
                    m_Vehicle.SetMaxAirPressureOfWheelInListOfWheels(31);
                    break;
                default:
                    throw new ArgumentException("Invalid type of vehicle");
            }

            return m_Vehicle;
        }
Ejemplo n.º 2
0
        public static FuelMotorcycle createFuelMotorcycle(Motorcycle i_Motorcycle, FuelVehicle.eFuelType i_FuelType, float i_CurrentAmountOfFuel, string i_Model, string i_LicensePlateNumber, float i_PercentOfRemainingEnergy, List <Tire> i_Tires)
        {
            FuelMotorcycle newFuelMotorcycle = new FuelMotorcycle(i_Motorcycle, i_FuelType, i_CurrentAmountOfFuel, i_Model, i_LicensePlateNumber, i_PercentOfRemainingEnergy, i_Tires);

            return(newFuelMotorcycle);
        }
Ejemplo n.º 3
0
        public static ElectricMotorcycle createElectricMotorcycle(Motorcycle i_Motorcycle, float i_RemainingBatteryTime, string i_Model, string i_LicensePlateNumber, float i_PercentOfRemainingEnergy, List <Tire> i_Tires)
        {
            ElectricMotorcycle newElectricMotorcycle = new ElectricMotorcycle(i_Motorcycle, i_RemainingBatteryTime, i_Model, i_LicensePlateNumber, i_PercentOfRemainingEnergy, i_Tires);

            return(newElectricMotorcycle);
        }
Ejemplo n.º 4
0
        public static Motorcycle createMotorcycle(Motorcycle.eTypeOfLicense i_TypeOfLicense, int i_EngineCapacity)
        {
            Motorcycle newMotorcycle = new Motorcycle(i_TypeOfLicense, i_EngineCapacity);

            return(newMotorcycle);
        }
Ejemplo n.º 5
0
        public static Vehicle MakeNewVehicle(eEnergyType i_EnergyType, eVehicleType i_VehicleType, string i_Model,
                                             string i_LicenseNumber, float[] i_WheelsAirPressure,
                                             string i_WheelsManufacturer, float i_CurrentEnrgeyLevel,
                                             string i_OwnerPhoneNumber, string i_OwnerName, object [] i_VehicleParameters)

        {
            Vehicle newVehicle = null;
            //i_WheelsAirPressure = new float[2] {1,2};
            float       energyPrecentage;
            PowerSystem powerSystem;

            switch (i_VehicleType)
            {
            case eVehicleType.Car:
            {
                if (i_EnergyType != eEnergyType.Electric)
                {
                    powerSystem      = new FeulPowerSystem(i_CurrentEnrgeyLevel, k_CarMaxGasCapacity, i_EnergyType);
                    energyPrecentage = (i_CurrentEnrgeyLevel / k_CarMaxGasCapacity) * 100;
                }
                else
                {
                    powerSystem      = new ElectricPowerSystem(i_CurrentEnrgeyLevel, k_CarMaxBatteryCapacity);
                    energyPrecentage = (i_CurrentEnrgeyLevel / k_CarMaxBatteryCapacity) * 100;
                }
                newVehicle = new Car(powerSystem, i_Model,
                                     i_LicenseNumber, energyPrecentage, k_CarWheelsAmount, i_WheelsAirPressure,
                                     k_CarWheelsMaxAirPressure,
                                     i_WheelsManufacturer, i_OwnerPhoneNumber, i_OwnerName);


                (newVehicle as Car).m_Color      = (eCarColor)i_VehicleParameters[0];
                (newVehicle as Car).m_NumOfDoors = (int)i_VehicleParameters[1];
            }
            break;

            case eVehicleType.Motorcycle:
            {
                if (i_EnergyType != eEnergyType.Electric)
                {
                    powerSystem      = new FeulPowerSystem(i_CurrentEnrgeyLevel, k_MotorcycleMaxGasCapacity, i_EnergyType);
                    energyPrecentage = (i_CurrentEnrgeyLevel / k_MotorcycleMaxGasCapacity) * 100;
                }
                else
                {
                    powerSystem      = new ElectricPowerSystem(i_CurrentEnrgeyLevel, k_MotorcycleMaxBatteryCapacity);
                    energyPrecentage = (i_CurrentEnrgeyLevel / k_MotorcycleMaxBatteryCapacity) * 100;
                }
                newVehicle = new Motorcycle(powerSystem, i_Model,
                                            i_LicenseNumber, energyPrecentage, k_MotorcycleWheelsAmount, i_WheelsAirPressure,
                                            k_MotorcycleWheelsMaxAirPressure,
                                            i_WheelsManufacturer, i_OwnerPhoneNumber, i_OwnerName);

                (newVehicle as Motorcycle).m_LicenseType    = (eLicenseType)i_VehicleParameters[0];
                (newVehicle as Motorcycle).m_EngineCapacity = (int)i_VehicleParameters[1];
            }
            break;

            case eVehicleType.Truck:
            {
                if (i_EnergyType != eEnergyType.Electric)
                {
                    powerSystem      = new FeulPowerSystem(i_CurrentEnrgeyLevel, k_TruckMaxGasCapacity, i_EnergyType);
                    energyPrecentage = (i_CurrentEnrgeyLevel / k_TruckMaxGasCapacity) * 100;
                }
                else
                {
                    powerSystem      = new ElectricPowerSystem(i_CurrentEnrgeyLevel, k_TruckMaxGasCapacity);
                    energyPrecentage = (i_CurrentEnrgeyLevel / k_TruckMaxGasCapacity) * 100;
                }
                newVehicle = new Truck(powerSystem, i_Model,
                                       i_LicenseNumber, energyPrecentage, k_TruckWheelsAmount, i_WheelsAirPressure,
                                       k_TruckWheelsMaxAirPressure,
                                       i_WheelsManufacturer, i_OwnerPhoneNumber, i_OwnerName);

                (newVehicle as Truck).m_IsCarryingDangerousMeterials = (bool)i_VehicleParameters[0];
                (newVehicle as Truck).m_CargoCapacity = (int)i_VehicleParameters[1];
            }
            break;
            }

            return(newVehicle);
        }
Ejemplo n.º 6
0
 //-------------------------------------------------------------------------//
 //                                Constructor                              //
 //-------------------------------------------------------------------------//
 public GasMotorcycle(string i_ModelName, string i_LicenceNumber, List <string> i_WheelsInfo, float i_EnergyLeftPercent, Motorcycle i_InnerVehicleInfo)
     : base(i_ModelName, i_LicenceNumber, k_GasType, k_MaxGasCapasity, i_EnergyLeftPercent)
 {
     m_Motorcycle = i_InnerVehicleInfo;
     m_Motorcycle.AddWheels(i_WheelsInfo);
 }
Ejemplo n.º 7
0
        /**
         * (1) Insert new vehicle
         */
        public Vehicle CreateVehicleObject(
            eVehicle i_TypeOfVehicle,
            string i_ModelName,
            string i_LicenseNumber,
            string i_OwnerPhoneNumber,
            string i_OwnerName,
            string i_WheelManufacturer,
            float i_CurrentAirPressure,
            float i_CurrentCapacity,
            List <object> i_ExtraProperties)
        {
            Vehicle newVehicle = null;

            try
            {
                if (i_TypeOfVehicle == eVehicle.FuelMotorcycle || i_TypeOfVehicle == eVehicle.ElectricMotorcycle)
                {
                    Motorcycle newMotorcycle = new Motorcycle(
                        i_TypeOfVehicle,
                        i_ModelName,
                        i_LicenseNumber,
                        i_OwnerPhoneNumber,
                        i_OwnerName,
                        i_WheelManufacturer,
                        i_CurrentAirPressure,
                        i_CurrentCapacity);
                    newMotorcycle.LicenseType  = (eLicenseType)i_ExtraProperties[0];
                    newMotorcycle.EngineVolume = (int)i_ExtraProperties[1];
                    newVehicle = newMotorcycle;
                }

                if (i_TypeOfVehicle == eVehicle.FuelCar || i_TypeOfVehicle == eVehicle.ElectricCar)
                {
                    Car newCar = new Car(
                        i_TypeOfVehicle,
                        i_ModelName,
                        i_LicenseNumber,
                        i_OwnerPhoneNumber,
                        i_OwnerName,
                        i_WheelManufacturer,
                        i_CurrentAirPressure,
                        i_CurrentCapacity);
                    newCar.CarColor         = (eCarColor)i_ExtraProperties[0];
                    newCar.NumberOfCarDoors = (eCarDoors)i_ExtraProperties[1];
                    newVehicle = newCar;
                }

                if (i_TypeOfVehicle == eVehicle.Truck)
                {
                    Truck newTruck = new Truck(
                        i_TypeOfVehicle,
                        i_ModelName,
                        i_LicenseNumber,
                        i_OwnerPhoneNumber,
                        i_OwnerName,
                        i_WheelManufacturer,
                        i_CurrentAirPressure,
                        i_CurrentCapacity);
                    newTruck.ContainsDangerousMaterials = (bool)i_ExtraProperties[0];
                    newTruck.VolumeOfCargo = (float)i_ExtraProperties[1];

                    newVehicle = newTruck;
                }

                if (i_TypeOfVehicle == eVehicle.Generic)
                {
                    Generic newGeneric = new Generic(
                        i_TypeOfVehicle,
                        i_ModelName,
                        i_LicenseNumber,
                        i_OwnerPhoneNumber,
                        i_OwnerName,
                        i_WheelManufacturer,
                        i_CurrentAirPressure,
                        i_CurrentCapacity,
                        (float)i_ExtraProperties[0],
                        (int)i_ExtraProperties[1],
                        (float)i_ExtraProperties[2],
                        (eFuelType)i_ExtraProperties[3]);
                    newVehicle = newGeneric;
                }

                // float i_CurrentCapacity,
                // float i_MaxAirPressure,
                // int i_NumberOfWheels,
                // float i_MaxCapacity,
                //     eFuelType i_FuelType)
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }

            return(newVehicle);
        }
Ejemplo n.º 8
0
 //-------------------------------------------------------------------------//
 //                                Constructor                              //
 //-------------------------------------------------------------------------//
 public ElectricMotorcycle(string i_ModelName, string i_LicenseNumber, List <string> i_WheelsInfo, float i_EnergyLeftPercent, Motorcycle i_InnerVehicleInfo) : base(i_ModelName, i_LicenseNumber, k_MaxBatteryTime, i_EnergyLeftPercent)
 {
     m_Motorcycle = i_InnerVehicleInfo;
     m_Motorcycle.AddWheels(i_WheelsInfo);
 }
Ejemplo n.º 9
0
 public ElectricMotorcycle(Motorcycle i_Motorcycle, float i_RemainingBatteryTime, string i_Model, string i_LicensePlateNumber, float i_PercentOfRemainingEnergy, List <Tire> i_Tires)
     : base(i_RemainingBatteryTime, i_Model, i_LicensePlateNumber, i_PercentOfRemainingEnergy, i_Tires, k_MaxBatteryTime)
 {
     m_Properties.Add(new Property("Max battery time", typeof(float)), k_MaxBatteryTime);
     m_Motorcycle = i_Motorcycle;
 }
 public ElectricMotorcycle(string i_ModelName, string i_LicensePlateNumber, int i_NumOfWheels, float i_MaxPressureLevelForWheel, float i_MaxBatteryTimeInHours) : base(i_ModelName, i_LicensePlateNumber, i_NumOfWheels, i_MaxPressureLevelForWheel, i_MaxBatteryTimeInHours)
 {
     m_Motorcycle = new Motorcycle();
 }