Ejemplo n.º 1
0
        private Vehicle chooseConstructorMethodByType()
        {
            Vehicle vehicle = null;

            VehicleTypes.eVehicleType vehicleType = getVehicleType();

            switch (vehicleType)
            {
            case VehicleTypes.eVehicleType.ElectricBike:
                vehicle = VehicleTypes.CreateNewElectricBike(
                    getModelName(),
                    getLicensePlateNumber(),
                    getTireManufacturers(vehicleType),
                    getCurrentPressureOfAllTires(vehicleType),
                    getRemainingBatteryTime(),
                    getBikeLicenseType(),
                    getBikeEngineVolume());
                break;

            case VehicleTypes.eVehicleType.ElectricCar:
                vehicle = VehicleTypes.CreateNewElectricCar(
                    getModelName(),
                    getLicensePlateNumber(),
                    getTireManufacturers(vehicleType),
                    getCurrentPressureOfAllTires(vehicleType),
                    getRemainingBatteryTime(),
                    getCarDoorAmount(),
                    getCarColor());
                break;

            case VehicleTypes.eVehicleType.PetrolBike:
                vehicle = VehicleTypes.CreateNewPetrolBike(
                    getModelName(),
                    getLicensePlateNumber(),
                    getTireManufacturers(vehicleType),
                    getCurrentPressureOfAllTires(vehicleType),
                    getRemainingFuelAmount(),
                    getBikeEngineVolume(),
                    getBikeLicenseType());
                break;

            case VehicleTypes.eVehicleType.PetrolCar:
                vehicle = VehicleTypes.CreateNewPetrolCar(
                    getModelName(),
                    getLicensePlateNumber(),
                    getTireManufacturers(vehicleType),
                    getCurrentPressureOfAllTires(vehicleType),
                    getRemainingFuelAmount(),
                    getCarDoorAmount(),
                    getCarColor());
                break;

            case VehicleTypes.eVehicleType.Truck:
                vehicle = VehicleTypes.CreateNewTruck(
                    getModelName(),
                    getLicensePlateNumber(),
                    getTireManufacturers(vehicleType),
                    getCurrentPressureOfAllTires(vehicleType),
                    getRemainingFuelAmount(),
                    getCheckIfTrunkIsCooled(),
                    getTrunkSize());
                break;
            }

            return(vehicle);
        }