Ejemplo n.º 1
0
 /// <summary>
 /// Makes the vehicle land at this airport.
 /// </summary>
 /// <param name="aerialVehicle">The vehicle to land.</param>
 /// <returns>A message about whether the vehicle was able to land.</returns>
 public string Land(AerialVehicle aerialVehicle)
 {
     // Make sure the plane can land.
     if (aerialVehicle is null)
     {
         throw new ArgumentNullException("aerialVehicle", "Aerial vehicle cannot be null.");
     }
     else if (vehicles.Count >= maxVehicles)
     {
         return($"{aerialVehicle} can't land because the airport is full.");
     }
     else
     {
         // Fly the plane down and stop the engine.
         aerialVehicle.FlyDown(aerialVehicle.CurrentAltitude);
         aerialVehicle.StopEngine();
         if (aerialVehicle.IsFlying)
         {
             return($"{aerialVehicle} was not able to land.");
         }
         else
         {
             // Add the vehicle to the airport.
             vehicles.Add(aerialVehicle);
             return($"{aerialVehicle} landed.");
         }
     }
 }
 public string Land(AerialVehicle a)
 {
     a.FlyDown(a.CurrentAltitude);
     a.isFlying = false;
     aerialVehicles.Add(a);
     MaxVehicles++;
     return($"{a} is landing at the airport.");
 }
        public string Land(AerialVehicle a)
        {
            a.FlyDown(a.CurrentAltitude);
            a.StopEngine();
            string land = $"{a} has just landed";

            return(land);
        }
 public string Land(AerialVehicle a)
 {
     // Check if there's room for the Aerial Vehicle to land, then add it to the Airport's Vehicles if there is room.
     if (Vehicles.Count < MaxVehicles)
     {
         a.FlyDown(a.CurrentAltitude);
         a.IsFlying = false;
         Vehicles.Add(a);
         return($"{a.GetType()} has landed successfully.");
     }
     return("The airport is currently full, and cannot accomidate any more aerial vehicles.");
 }
 public string Land(AerialVehicle a)
 {
     if (Vehicles.Count < MaxVehicles)
     {
         Vehicles.Add(a);
         if (a.CurrentAltitude > 0)
         {
             //This makes sure how ever high the vehicle is it always end up at 0
             a.FlyDown(a.CurrentAltitude);
         }
         return($"{a} lands at {AirportCode}.");
     }
     return($"{AirportCode} is right now full and can't land {a}.");
 }
 public string Land(AerialVehicle a)
 {
     if (Vehicles.Count < MaxVehicles)
     {
         a.FlyDown(a.CurrentAltitude);
         a.IsFlying = false;
         Vehicles.Add(a);
         return(a + " landing!");
     }
     else
     {
         return("Not enough space!");
     }
 }
        public string Land(AerialVehicle a)
        {
            if (Vehicles.Count < MaxVehicles)
            {
                a.FlyDown(a.CurrentAltitude);
                a.IsFlying = false;
                Vehicles.Add(a);
            }
            else
            {
                return("The airport is full so the vehicle could not land");
            }

            return("An aerial vehicle has landed");
        }
        string Land(AerialVehicle a)
        {
            // Makes sure Airport is not full
            if (this.MaxVehicles < Vehicles.Count)
            {
                // Landing should fly Aerial Vehicle to the ground
                a.FlyDown(0);
                a.isFlying = false;

                // Add to Airport's Vehicles
                Vehicles.Add(a);

                return("Aerial Vehicle has been put inside Airport");
            }
            else
            {
                return("this airport is full");
            }
        }