An airport uses an object-oriented program to keep track of arrivals and departures of planes. There are many objects in this system and some are listed below.

The code below outlines the Arrival class used in this program.
public class Flight
{ private String id;
public String getId() {return this.id;}
// ... more variables, accessor and mutator methods
}
**
public class** Arrival
{ private Flight myFlight;
private String sta; // Scheduled Time of Arrival ('hh:mm')
private int runway;
private String gate;
private int delay;
private boolean landed;
public Arrival(Flight myFlight, String sta)
{ **this.**myFlight = myFlight;
**this.**sta = sta;
**this.**runway = 0;
**this.**gate = null;
**this.**delay = 0;
**this.**landed = false;
}
public void addDelay(int newDelay)
{ **this.**delay = newDelay;
}
public String getETA()
{ // calculates the Estimated Time of Arrival (ETA) of the flight
// by adding the delay to the sta and returning the result as a
// String ('hh:mm')
}
public int compareWith(String flightID)
{ if (myFlight.getId().equals(flightID)) { return 0; }
else { return 1; }
}
public int compareWith(Arrival anotherArrival)
{ // missing code
}
// ... plus accessor and mutator methods
}
The code below outlines part of the FlightManagement class used in this program.
For the purposes of this exam only arriving flights are being considered.
public class FlightManagement
{
private Arrival$$ inbound; // array of inbound airplanes
private int last = -1; // index of last used entry
public FlightManagement()
{ inbound = new Arrival;
}
public void add(Arrival newArrival)
{ // missing code that adds the newArrival to the array inbound
// sorted by ETA, and updates last
}
private int search (String flightID)
{ // missing code that searches the array inbound and
// returns the index of the Arrival object with flightID
}
public Arrival remove(String flightID)
{ Arrival result;
int index = search(flightID);
result = inbound;
while (index < last)
{ inbound = inbound;
index++;
}
last--;
return result;
}
// ... many more methods
}
The method search in the FlightManagement class searches the array inbound and returns the index of the Arrival object with the given flightID.
the relationship between and shown in the code.

