Beispiel #1
0
 public Aircraft(string regNumber, string colorOrLivery, int numberOfWheels, int emptyMass, string manufacturer, string model, string typeDesignator,
                 AircraftType typeDescription, AircraftEngineType engineType, int engineCount)
     : base(regNumber, colorOrLivery, numberOfWheels, emptyMass)
 {
     Manufacturer    = manufacturer;
     Model           = model;
     TypeDesignator  = typeDesignator;
     TypeDescription = typeDescription;
     EngineType      = engineType;
     EngineCount     = engineCount;
 }
Beispiel #2
0
        public static bool CreateAircraft(string[] input, out Aircraft vehicle)
        {
            vehicle = null;
            if (input.Length != 11)
            {
                errorMessages.Add($"To park an aircraft you need to specify 11 values. {input.Length} values were found.");
                return(false);
            }
            int                numberOfWheels, emptyMass, engineCount;
            AircraftType       aircraftType       = (AircraftType)Enum.Parse(typeof(AircraftType), input[8]);
            AircraftEngineType aircraftEngineType = (AircraftEngineType)Enum.Parse(typeof(AircraftEngineType), input[9]);

            int.TryParse(input[10], out engineCount);
            if (!int.TryParse(input[3], out numberOfWheels) || !int.TryParse(input[4], out emptyMass) || !int.TryParse(input[10], out engineCount))
            {
                errorMessages.Add("Please make sure to enter numbers where requested.");
                return(false);
            }
            vehicle = new Aircraft(input[1], input[2], numberOfWheels, emptyMass, input[5], input[6], input[7], aircraftType, aircraftEngineType, engineCount);
            return(true);
        }