コード例 #1
0
ファイル: Vehicle.cs プロジェクト: itayko2/csharp_2019
        public Vehicle(

            string i_OwnersName,
            string i_OwnersPhone,
            string i_Model,
            string i_RegistrationPlate,
            Energy i_EnergyType,
            float i_EnergyLevel,
            int i_NumberOfWheels,
            string i_ManufacturerName,
            float i_CurrentAirPressure,
            float i_MaxAirPressure,
            GarageENums.eVehicleType i_VehicleType)
        {
            m_OwnersName         = i_OwnersName;
            m_OwnersPhone        = i_OwnersPhone;
            r_Model              = i_Model;
            r_RegistrationPlate  = i_RegistrationPlate;
            m_EnergyType         = i_EnergyType;
            m_EnergyLevel        = i_EnergyLevel;
            m_CurrentAirPressure = i_CurrentAirPressure;
            m_NumberOfWheels     = i_NumberOfWheels;
            m_VehicleType        = i_VehicleType;
            m_Wheels             = new List <Wheel>();
            setVehicleWheels(i_ManufacturerName, m_CurrentAirPressure, m_NumberOfWheels, i_MaxAirPressure);
        }
コード例 #2
0
ファイル: Motorcycle.cs プロジェクト: itayko2/csharp_2019
 public Motorcycle(
     string i_OwnersName,
     string i_OwnersPhone,
     string i_Model,
     string i_RegistrationPlate,
     Energy i_EnergyType,
     float i_EnergyLevel,
     float i_CurrentAirPressure,
     string i_ManufacturerName,
     GarageENums.eVehicleType i_VehicleType,
     Motorcycle.eMotorcycleLicenseType i_LicenseType,
     int i_EngineDisplacement)
     : base(
         i_OwnersName,
         i_OwnersPhone,
         i_Model,
         i_RegistrationPlate,
         i_EnergyType,
         i_EnergyLevel,
         k_MotorcycleWheelsNumber,
         i_ManufacturerName,
         i_CurrentAirPressure,
         k_MotorcycleWheelMaxAirPressure,
         i_VehicleType)
 {
     m_EngineDisplacement = i_EngineDisplacement;
     m_LicenseType        = i_LicenseType;
 }
コード例 #3
0
ファイル: Car.cs プロジェクト: itayko2/csharp_2019
 public Car(
     string i_OwnersName,
     string i_OwnersPhone,
     string i_Model,
     string i_RegistrationPlate,
     Energy i_EnergyType,
     float i_EnergyLevel,
     float i_CurrentAirPressure,
     string i_ManufacturerName,
     GarageENums.eVehicleType i_VehicleType,
     Car.eCarColor i_CarColor,
     Car.eNumberOfCarDoors i_NumberOfDoors)
     : base(
         i_OwnersName,
         i_OwnersPhone,
         i_Model,
         i_RegistrationPlate,
         i_EnergyType,
         i_EnergyLevel,
         k_CarWheelsNumber,
         i_ManufacturerName,
         i_CurrentAirPressure,
         k_CarWheelMaxPressure,
         i_VehicleType)
 {
     m_CarColor      = i_CarColor;
     m_NumberOfDoors = i_NumberOfDoors;
 }
コード例 #4
0
ファイル: Truck.cs プロジェクト: itayko2/IDC_Projects
 public Truck(
     string i_OwnersName,
     string i_OwnersPhone,
     string i_Model,
     string i_RegistrationPlate,
     Energy i_EnergyType,
     float i_EnergyLevel,
     float i_CurrentAirPressure,
     string i_ManufacturerName,
     GarageENums.eVehicleType i_VehicleType,
     float i_MaxLoad,
     bool i_IsCarryingHazardousMaterials)
     : base(
         i_OwnersName,
         i_OwnersPhone,
         i_Model,
         i_RegistrationPlate,
         i_EnergyType,
         i_EnergyLevel,
         k_TruckWheelsNumber,
         i_ManufacturerName,
         i_CurrentAirPressure,
         k_TruckWheelMaxAirPressure,
         i_VehicleType)
 {
     r_MaxLoad = i_MaxLoad;
     m_IsCarryingHazardousMaterials = i_IsCarryingHazardousMaterials;
 }
コード例 #5
0
        private static Vehicle getVehicleFromUser()
        {
            Vehicle       createdVehicle        = null;
            List <object> userEnteredProperties = null;

            GarageENums.eVehicleType typeOfVehicleToAdd = (GarageENums.eVehicleType)getUserChoiceFromEnumValues(typeof(GarageENums.eVehicleType));

            switch (typeOfVehicleToAdd)
            {
            case GarageENums.eVehicleType.FuelCar:
                userEnteredProperties = getPropertiesFromUser(FuelCar.GetRequiredProperties(), 1);
                break;

            case GarageENums.eVehicleType.ElectricCar:
                userEnteredProperties = getPropertiesFromUser(ElectricCar.GetRequiredProperties(), 2);
                break;

            case GarageENums.eVehicleType.FuelMotorcycle:
                userEnteredProperties = getPropertiesFromUser(FuelMotorcycle.GetRequiredProperties(), 3);
                break;

            case GarageENums.eVehicleType.ElectricMotorcycle:
                userEnteredProperties = getPropertiesFromUser(ElectricMotorcycle.GetRequiredProperties(), 4);
                break;

            case GarageENums.eVehicleType.FuelTruck:
                userEnteredProperties = getPropertiesFromUser(FuelTruck.GetRequiredProperties(), 5);
                break;

            default:
                break;
            }

            createdVehicle = VehicleGenerator.GenerateVehicle(typeOfVehicleToAdd, userEnteredProperties);

            return(createdVehicle);
        }
コード例 #6
0
        public static Vehicle GenerateVehicle(GarageENums.eVehicleType i_VehicleType, List <object> i_VehicleInfo)
        {
            Vehicle newVehicle = null;

            switch (i_VehicleType)
            {
            case GarageENums.eVehicleType.FuelCar:
                newVehicle = new FuelCar((string)i_VehicleInfo[0],
                                         (string)i_VehicleInfo[1],
                                         (string)i_VehicleInfo[2],
                                         (string)i_VehicleInfo[3],
                                         (float)i_VehicleInfo[4],
                                         (float)i_VehicleInfo[5],
                                         (string)i_VehicleInfo[6],
                                         (Car.eCarColor)i_VehicleInfo[7],
                                         (Car.eNumberOfCarDoors)i_VehicleInfo[8]);
                break;

            case GarageENums.eVehicleType.ElectricCar:
                newVehicle = new ElectricCar((string)i_VehicleInfo[0],
                                             (string)i_VehicleInfo[1],
                                             (string)i_VehicleInfo[2],
                                             (string)i_VehicleInfo[3],
                                             (float)i_VehicleInfo[4],
                                             (float)i_VehicleInfo[5],
                                             (string)i_VehicleInfo[6],
                                             (Car.eCarColor)i_VehicleInfo[7],
                                             (Car.eNumberOfCarDoors)i_VehicleInfo[8]);
                break;

            case GarageENums.eVehicleType.FuelMotorcycle:
                newVehicle = new FuelMotorcycle((string)i_VehicleInfo[0],
                                                (string)i_VehicleInfo[1],
                                                (string)i_VehicleInfo[2],
                                                (string)i_VehicleInfo[3],
                                                (float)i_VehicleInfo[4],
                                                (float)i_VehicleInfo[5],
                                                (string)i_VehicleInfo[6],
                                                (Motorcycle.eMotorcycleLicenseType)i_VehicleInfo[7],
                                                (int)i_VehicleInfo[8]);
                break;

            case GarageENums.eVehicleType.ElectricMotorcycle:
                newVehicle = new ElectricMotorcycle((string)i_VehicleInfo[0],
                                                    (string)i_VehicleInfo[1],
                                                    (string)i_VehicleInfo[2],
                                                    (string)i_VehicleInfo[3],
                                                    (float)i_VehicleInfo[4],
                                                    (float)i_VehicleInfo[5],
                                                    (string)i_VehicleInfo[6],
                                                    (Motorcycle.eMotorcycleLicenseType)i_VehicleInfo[7],
                                                    (int)i_VehicleInfo[8]);
                break;

            case GarageENums.eVehicleType.FuelTruck:
                newVehicle = new FuelTruck((string)i_VehicleInfo[0],
                                           (string)i_VehicleInfo[1],
                                           (string)i_VehicleInfo[2],
                                           (string)i_VehicleInfo[3],
                                           (float)i_VehicleInfo[4],
                                           (float)i_VehicleInfo[5],
                                           (string)i_VehicleInfo[6],
                                           (float)i_VehicleInfo[7],
                                           (bool)i_VehicleInfo[8]);
                break;
            }

            return(newVehicle);
        }