コード例 #1
0
        public CargoPlane(ManufacturerEnum manufacturer,
                          string model,
                          int flightRange,
                          int cruiseSpeed,
                          int passengersNumber,
                          int carryingCapacity,
                          string usage) : base(manufacturer, model, flightRange, cruiseSpeed, passengersNumber, carryingCapacity)

        {
            Usage = usage;
        }
コード例 #2
0
 public PassengerPlane(ManufacturerEnum manufacturer,
                       string model,
                       int flightRange,
                       int cruiseSpeed,
                       int passengersNumber,
                       int carryingCapacity,
                       string passengerClass,
                       bool luggage) : base(manufacturer, model, flightRange, cruiseSpeed, passengersNumber, carryingCapacity)
 {
     PassengersClass = passengerClass;
     Luggage         = luggage;
 }
コード例 #3
0
 public static Car CreateCar(ManufacturerEnum manufacturer)
 {
     var production = ProductionFactory.CreateProduction(manufacturer);
     return new Car
     {
         Door = production.Door,
         Engine = production.Engine,
         Manufacturer = manufacturer.ToString(),
         Model = production.Model,
         Tires = production.Tires
     };
 }
コード例 #4
0
        public static Car CreateCar(ManufacturerEnum manufacturer)
        {
            var production = ProductionFactory.CreateProduction(manufacturer);

            return(new Car
            {
                Door = production.Door,
                Engine = production.Engine,
                Manufacturer = manufacturer.ToString(),
                Model = production.Model,
                Tires = production.Tires
            });
        }
コード例 #5
0
 public static IProduction CreateProduction(ManufacturerEnum manufacturer)
 {
     switch (manufacturer)
     {
         case ManufacturerEnum.Audi:
             return new AudiProduction();
         case ManufacturerEnum.BMW:
             return new BmwProduction();
         case ManufacturerEnum.Mercedes:
             return new MercedesProduction();
         default:
             return new VolkswagenProduction();
     }
 }
コード例 #6
0
        public static IProduction CreateProduction(ManufacturerEnum manufacturer)
        {
            switch (manufacturer)
            {
            case ManufacturerEnum.Audi:
                return(new AudiProduction());

            case ManufacturerEnum.BMW:
                return(new BmwProduction());

            case ManufacturerEnum.Mercedes:
                return(new MercedesProduction());

            default:
                return(new VolkswagenProduction());
            }
        }
コード例 #7
0
ファイル: Plane.cs プロジェクト: ptamara-MS/study-projects
 public Plane(ManufacturerEnum manufacturer, string model, int flightRange, int cruiseSpeed, int passengersNumber, int carryingCapacity)
 {
     if (cruiseSpeed < 0)
     {
         throw new ArgumentException();
     }
     if (passengersNumber < 0 || passengersNumber > 1000)
     {
         throw new ArgumentOutOfRangeException();
     }
     Manufacturer     = manufacturer;
     Model            = model ?? throw new ArgumentNullException();
     FlightRange      = flightRange;
     CruiseSpeed      = cruiseSpeed;
     PassengersNumber = passengersNumber;
     CarryingCapacity = carryingCapacity;
 }