コード例 #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.");
         }
     }
 }
コード例 #2
0
        public string TakeOff(AerialVehicle a)
        {
            a.StartEngine();
            a.TakeOff();

            return($"{a} is taking off");
        }
コード例 #3
0
 public string TakeOff(AerialVehicle a)
 {
     a.StartEngine();
     a.TakeOff();
     Vehicles.Remove(a);
     return("An aerial vehicle has taken off");
 }
コード例 #4
0
        public string Land(AerialVehicle a)
        {
            a.FlyDown(a.CurrentAltitude);
            a.StopEngine();
            string land = $"{a} has just landed";

            return(land);
        }
コード例 #5
0
 public string TakeOff(AerialVehicle a)
 {
     a.isFlying = true;
     a.FlyUp();
     aerialVehicles.Remove(a);
     MaxVehicles--;
     return($"{a} is taking off.");
 }
コード例 #6
0
 public string TakeOff(AerialVehicle a)
 {
     a.StartEngine();
     a.IsFlying = true;
     a.FlyUp(50);
     Vehicles.Remove(a);
     return(a + " taking off!");
 }
コード例 #7
0
 public string Land(AerialVehicle a)
 {
     a.FlyDown(a.CurrentAltitude);
     a.isFlying = false;
     aerialVehicles.Add(a);
     MaxVehicles++;
     return($"{a} is landing at the airport.");
 }
コード例 #8
0
 public void Land(AerialVehicle a)
 {
     if (a.Isflying == false && Vehicle.Count < MaxVehicles)
     {
         a.StopEngine();
         Vehicle.Add(a);
     }
 }
コード例 #9
0
        public string Land(AerialVehicle a)
        {
            a.CurrentAltitude = 0;
            a.StopEngine();
            a.IsFlying = false;
            Vehicles.Add(a);

            return($"{a.ToString()} has landed");
        }
コード例 #10
0
 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.");
 }
コード例 #11
0
 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}.");
 }
コード例 #12
0
 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!");
     }
 }
コード例 #13
0
        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");
        }
コード例 #14
0
        public string TakeOff(AerialVehicle a)
        {
            string ret;

            a.StartEngine();
            a.TakeOff();
            if (a.IsFlying)
            {
                ret = $"{a.ToString()} took off successfully.";
                Vehicles.Remove(a);
            }
            else
            {
                ret = $"{a.ToString()} could not take off.";
            }

            return(ret);
        }
コード例 #15
0
        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");
            }
        }
コード例 #16
0
 /// <summary>
 /// Makes the vehicle leave this airport.
 /// </summary>
 /// <param name="aerialVehicle">The vehicle to leave.</param>
 /// <returns>A message about whether the vehicle was able to leave.</returns>
 public string TakeOff(AerialVehicle aerialVehicle)
 {
     // Make sure the plane can take off.
     if (aerialVehicle is null)
     {
         throw new ArgumentNullException("aerialVehicle", "Aerial vehicle cannot be null.");
     }
     else if (!vehicles.Contains(aerialVehicle))
     {
         return($"{aerialVehicle} can't takeoff because it is not at this airport.");
     }
     else
     {
         // Get the takeoff message and remove
         // the vehicle from the airport.
         string message = aerialVehicle.TakeOff();
         if (aerialVehicle.IsFlying)
         {
             vehicles.Remove(aerialVehicle);
         }
         return(message);
     }
 }
コード例 #17
0
 public string TakeOff(AerialVehicle a)
 {
     // NOTE TO SELF: This just lets a random Aerial Vehicle take off. Should there be a prerequesite that the vehicle itself was inside of the Airport (existed within its Vehicles List)? Or are these theorhetical random planes that are coming in and immediately taking off again?
     a.StartEngine();
     return(a.TakeOff());
 }
コード例 #18
0
 public string TakeOff(AerialVehicle a)
 {
     Vehicles.Remove(a);
     return($"{a.TakeOff()} from {AirportCode}.");
 }
コード例 #19
0
 public string Land(AerialVehicle a)
 {
     return("The current vehicle gone");
 }
コード例 #20
0
 string TakeOff(AerialVehicle a)
 {
     return("");
 }
コード例 #21
0
 public void AddtoPort(AerialVehicle a)
 {
     Vehicle.Add(a);
 }
コード例 #22
0
        public string Takeoff(AerialVehicle a)
        {
            a.TakeOff();

            return(a.Name + " has taken off");
        }