예제 #1
0
        public Car(TypeOfEngine type) : base(WheeledVehicleType.car)
        {
            EngineType = type;

            Console.WriteLine(EngineType == TypeOfEngine.electric ? "Elctric cars must be brought in specialized repair shops" : "Non electric cars can be" +
                              " brought to regular repair shops");
        }
예제 #2
0
 public EngineType(
     string model,
     Manufacturer manufacturer,
     TypeOfEngine engine,
     NoiseLevel noise,
     double consumptation,
     long price,
     int maxspeed,
     int ceiling,
     double runway,
     double range,
     Period<int> produced)
 {
     Model = model;
     Manufacturer = manufacturer;
     Engine = engine;
     ConsumptationModifier = consumptation;
     Price = price;
     MaxSpeed = maxspeed;
     Ceiling = ceiling;
     RunwayModifier = runway;
     RangeModifier = range;
     Produced = produced;
     Types = new List<AirlinerType>();
     Noise = noise;
 }
예제 #3
0
 public EngineType(string model, string manufacturer, TypeOfEngine engine, NoiseLevel noise, double consumptation, long price, int maxspeed, int ceiling, double runway, double range, Period<int> produced)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Engine = engine;
     this.ConsumptationModifier = consumptation;
     this.Price = price;
     this.MaxSpeed = maxspeed;
     this.Ceiling = ceiling;
     this.RunwayModifier = runway;
     this.RangeModifier = range;
     this.Produced = produced;
     this.Types = new List<AirlinerType>();
 }
예제 #4
0
 public EngineType(string model, string manufacturer, TypeOfEngine engine, NoiseLevel noise, double consumptation, long price, int maxspeed, int ceiling, double runway, double range, Period <int> produced)
 {
     this.Model                 = model;
     this.Manufacturer          = manufacturer;
     this.Engine                = engine;
     this.ConsumptationModifier = consumptation;
     this.Price                 = price;
     this.MaxSpeed              = maxspeed;
     this.Ceiling               = ceiling;
     this.RunwayModifier        = runway;
     this.RangeModifier         = range;
     this.Produced              = produced;
     this.Types                 = new List <AirlinerType>();
 }
예제 #5
0
        }                                        // protected e za da moze da se menuva samo preku SwitchToBatteryOrEngine metodot



        public ElectricCar(TypeOfEngine engineType) : base() // Ne go napraviv bonusot so setiranje na EngineType ovde, ama samo zasto mi e malku druga logikata na zadacata. Imeno ne sakam da setiram electrtic Engine zatoa sto elektricnite koli moze da se i hibridi, ne samo elektricni. Osven toa, samata zadaca e malku cudno postavena i me zbuni i zatoa otidov vo ovaa nasoka, zasto vo bonusot za electric car klasava ima staeno da se limitira maxSpeed "when on battery", sto vsusnost i sugerirase deka treba da postoi i opcija hibrid, bidejkji elektricnite koli se samo na akumulator, pa ako ne staev i hibrid, kje nemase smisla i poenta toa bonus baranje.

            // Isto, bidejkji nasleduva od Car, izlisno bi bilo da imase samo opcija za elektricna kola, bidejkji togas kje nemase smisla nasledenoto FuelConsumption Property.
        {
            EngineType = engineType;
            if (engineType != TypeOfEngine.Electric && engineType != TypeOfEngine.Hybrid) // Ne znam kako da ogranicam da moze da se vnese samo hibrid ili samo electric od enumite, pa zatoa samo so predupreduvanjevo vo konzola nastapiv hahaha. Mozebi mora da se napravat posebni klasi hibrid i elektricna kola, dokolku ne moze preku samata klasa da se ogranici, kje mi kazete.
            {
                Console.WriteLine("An electric car can have either an electric motor only, or be a hybrid.");
            }

            if (engineType == TypeOfEngine.Electric)
            {
                IsOnBattery = true;
            }
        }
예제 #6
0
        public Tank(Factory factoryType, TypeOfArmor armorType, TypeOfGun gunType, TypeOfEngine engineType)
        {
            name = factoryType.SetName();
            gun  = factoryType.CreateGun(gunType);
            SetComponent(gun);
            engine = factoryType.CreateEngine(engineType);
            SetComponent(engine);
            armor = factoryType.CreateArmor(armorType);
            SetComponent(armor);

            factory      = factoryType;
            typeOfArmor  = armorType;
            typeOfGun    = gunType;
            typeOfEngine = engineType;
        }
예제 #7
0
 public AirlinerCargoType(
     Manufacturer manufacturer,
     string name,
     string family,
     int cockpitcrew,
     double cargoSize,
     double speed,
     long range,
     double wingspan,
     double length,
     double weight,
     double consumption,
     long price,
     long minRunwaylength,
     long fuelcapacity,
     BodyType body,
     TypeRange rangeType,
     TypeOfEngine engine,
     Period<DateTime> produced,
     int prodRate,
     bool isConvertable,
     bool standardType = true)
     : base(manufacturer,
         TypeOfAirliner.Cargo,
         name,
         family,
         cockpitcrew,
         speed,
         range,
         wingspan,
         length,
         weight,
         consumption,
         price,
         minRunwaylength,
         fuelcapacity,
         body,
         rangeType,
         engine,
         produced,
         prodRate,
         isConvertable,
         standardType)
 {
     CargoSize = cargoSize;
 }
예제 #8
0
        public override Engine CreateEngine(TypeOfEngine type)
        {
            switch (type)
            {
            case TypeOfEngine.Diesel:
            {
                return(new DieselEngine());
            }

            case TypeOfEngine.Gasturbine:
            {
                return(new GasturbineEngine());
            }

            default:
            {
                return(new GasturbineEngine());
            }
            }
        }
예제 #9
0
 public void SetEngineType(TypeOfEngine engineType)
 {
     this.type = engineType;
 }
예제 #10
0
 protected AirlinerType(
     Manufacturer manufacturer,
     TypeOfAirliner typeOfAirliner,
     string name,
     string family,
     int cockpitCrew,
     double speed,
     long range,
     double wingspan,
     double length,
     double weight,
     double consumption,
     long price,
     long minRunwaylength,
     long fuelcapacity,
     BodyType body,
     TypeRange rangeType,
     TypeOfEngine engine,
     Period<DateTime> produced,
     int prodRate,
     bool isConvertable,
     bool standardType)
 {
     TypeAirliner = typeOfAirliner;
     AirlinerFamily = family;
     Manufacturer = manufacturer;
     Name = name;
     CruisingSpeed = speed;
     Range = range;
     Wingspan = wingspan;
     Length = length;
     Weight = weight;
     CockpitCrew = cockpitCrew;
     Price = price;
     FuelConsumption = consumption;
     Produced = produced;
     Engine = engine;
     Body = body;
     RangeType = rangeType;
     MinRunwaylength = minRunwaylength;
     FuelCapacity = fuelcapacity;
     IsStandardType = standardType;
     ProductionRate = prodRate;
     IsConvertable = isConvertable;
 }
예제 #11
0
 public AirlinerPassengerType(
     Manufacturer manufacturer,
     string name,
     string family,
     int seating,
     int cockpitcrew,
     int cabincrew,
     double speed,
     long range,
     double wingspan,
     double length,
     double weight,
     double consumption,
     long price,
     int maxAirlinerClasses,
     long minRunwaylength,
     long fuelcapacity,
     BodyType body,
     TypeRange rangeType,
     TypeOfEngine engine,
     Period<DateTime> produced,
     int prodRate,
     bool isConvertable,
     bool standardType = true)
     : base(manufacturer,
         TypeOfAirliner.Passenger,
         name,
         family,
         cockpitcrew,
         speed,
         range,
         wingspan,
         length,
         weight,
         consumption,
         price,
         minRunwaylength,
         fuelcapacity,
         body,
         rangeType,
         engine,
         produced,
         prodRate,
         isConvertable,
         standardType)
 {
     MaxSeatingCapacity = seating;
     CabinCrew = cabincrew;
     MaxAirlinerClasses = maxAirlinerClasses;
 }
예제 #12
0
 /// <summary>
 /// Создать двигатель
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public abstract Engine CreateEngine(TypeOfEngine type);
예제 #13
0
        public static Tank CreateFromFile(string path)
        {
            var info = File.ReadAllLines(path);

            TypeOfArmor  armorType   = TypeOfArmor.Composite;
            TypeOfEngine engineType  = TypeOfEngine.Gasturbine;
            TypeOfGun    gunType     = TypeOfGun.Tank;
            Factory      factoryType = new RussianFactory();

            try
            {
                switch (info[0])
                {
                case "Russian":
                {
                    factoryType = new RussianFactory();
                    break;
                }

                case "American":
                {
                    factoryType = new AmericanFactory();
                    break;
                }
                }
                switch (info[1])
                {
                case "Artillery":
                {
                    gunType = TypeOfGun.Artillery;
                    break;
                }

                case "Tank":
                {
                    gunType = TypeOfGun.Tank;
                    break;
                }
                }
                switch (info[2])
                {
                case "Dynamic":
                {
                    armorType = TypeOfArmor.Dynamic;
                    break;
                }

                case "Composite":
                {
                    armorType = TypeOfArmor.Composite;
                    break;
                }
                }
                switch (info[3])
                {
                case "Diesel":
                {
                    engineType = TypeOfEngine.Diesel;
                    break;
                }

                case "Gasturbine":
                {
                    engineType = TypeOfEngine.Gasturbine;
                    break;
                }
                }
            }
            catch (FormatException) { throw new FileFormatException("Входной файл имел неверный формат"); }

            return(new Tank(factoryType, armorType, gunType, engineType));
        }