public string TakeOff(AerialVehicle a) { a.StartEngine(); a.TakeOff(); return($"{a} is taking off"); }
public string TakeOff(AerialVehicle a) { a.StartEngine(); a.TakeOff(); Vehicles.Remove(a); return("An aerial vehicle has taken off"); }
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); }
/// <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); } }
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()); }
public string TakeOff(AerialVehicle a) { Vehicles.Remove(a); return($"{a.TakeOff()} from {AirportCode}."); }
public string Takeoff(AerialVehicle a) { a.TakeOff(); return(a.Name + " has taken off"); }