Exemplo 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.");
         }
     }
 }
Exemplo n.º 2
0
 public void Land(AerialVehicle a)
 {
     if (a.Isflying == false && Vehicle.Count < MaxVehicles)
     {
         a.StopEngine();
         Vehicle.Add(a);
     }
 }
        public string Land(AerialVehicle a)
        {
            a.FlyDown(a.CurrentAltitude);
            a.StopEngine();
            string land = $"{a} has just landed";

            return(land);
        }
        public string Land(AerialVehicle a)
        {
            a.CurrentAltitude = 0;
            a.StopEngine();
            a.IsFlying = false;
            Vehicles.Add(a);

            return($"{a.ToString()} has landed");
        }