示例#1
0
        public static Vehicle CreateVehicle(eVehicleOption i_ChonsenVehicle, string i_LicenceNum, string i_Model)
        {
            Vehicle newVehicle = null;

            switch (i_ChonsenVehicle)
            {
            case eVehicleOption.FuelCar:
                newVehicle = new FuelCar(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.ElecticCar:
                newVehicle = new ElectricCar(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.FuelMotorcycle:
                newVehicle = new FuelMotorcycle(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.ElectricMotorcycle:
                newVehicle = new ElectricMotorcycle(i_LicenceNum, i_Model);
                break;

            case eVehicleOption.FuelTrack:
                newVehicle = new FuelTrack(i_LicenceNum, i_Model);
                break;
            }

            return(newVehicle);
        }
示例#2
0
        public static Vehicle CreateVehicle(eVehicleTypes i_VehicleTypeAsInt)
        {
            eVehicleTypes vehicleType = (eVehicleTypes)i_VehicleTypeAsInt;
            Vehicle       createdVehicle;

            switch (vehicleType)
            {
            case eVehicleTypes.GasMotorcycle:
                createdVehicle = new GasMotorcycle();
                break;

            case eVehicleTypes.ElectricMotorcycle:
                createdVehicle = new ElectricMotorcycle();
                break;

            case eVehicleTypes.GasCar:
                createdVehicle = new GasCar();
                break;

            case eVehicleTypes.ElectricCar:
                createdVehicle = new ElectricCar();
                break;

            case eVehicleTypes.GasTruck:
                createdVehicle = new GasTruck();
                break;

            default:
                throw new Exception("This kind of vehicle is not supported in the garage");
            }

            return(createdVehicle);
        }
示例#3
0
        public static Vehicle CreateNewVehicle(eVehicleType i_VehicleType, string i_LicenseNumber, string i_OwnerName, string i_OwnerPhoneNumber, string i_ModelName)
        {
            Vehicle newVehicle;

            switch (i_VehicleType)
            {
            case eVehicleType.FuelBasedMotorcycle:
                newVehicle = new FuelBasedMotorcycle(i_LicenseNumber, i_OwnerName, i_OwnerPhoneNumber, i_ModelName);
                break;

            case eVehicleType.FuelBasedCar:
                newVehicle = new FuelBasedCar(i_LicenseNumber, i_OwnerName, i_OwnerPhoneNumber, i_ModelName);
                break;

            case eVehicleType.ElectricMotorcycle:
                newVehicle = new ElectricMotorcycle(i_LicenseNumber, i_OwnerName, i_OwnerPhoneNumber, i_ModelName);
                break;

            case eVehicleType.ElectricCar:
                newVehicle = new ElectricCar(i_LicenseNumber, i_OwnerName, i_OwnerPhoneNumber, i_ModelName);
                break;

            default:
                newVehicle = new FuelBasedTruck(i_LicenseNumber, i_OwnerName, i_OwnerPhoneNumber, i_ModelName);
                break;
            }

            return(newVehicle);
        }
        public static Vehicle BuildVehicle(eVehicleType i_VehicleType, string i_LicenseNumber, string i_ModelType, string i_ManufacturerName)
        {
            Vehicle newVehicle = null;

            switch (i_VehicleType)
            {
            case eVehicleType.ElectricCar:
            {
                newVehicle = new ElectricCar(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }

            case eVehicleType.ElectricMotorcycle:
            {
                newVehicle = new ElectricMotorcycle(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }

            case eVehicleType.FuelCar:
            {
                newVehicle = new FuelCar(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }

            case eVehicleType.FuelMotorcycle:
            {
                newVehicle = new FuelMotorcycle(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }

            case eVehicleType.FuelTruck:
            {
                newVehicle = new FuelTruck(i_LicenseNumber, i_ModelType, i_ManufacturerName);
                break;
            }
            }

            return(newVehicle);
        }