Refactoring the flight tracker
This chapter’s code focuses largely on a single FlightTracker
class intended to track and display the outgoing flights from a commercial airport for passengers in the terminal, as pictured in Figure 4.1:
Figure 4.1 – FlightTracker displaying outbound flight statuses
The FlightTracker
class has a number of methods related to managing and displaying flights. It is supported by the Flight
class which represents an individual flight in the system and the FlightStatus
enum
which represents all relevant statuses of a flight, as shown in the class diagram in Figure 4.2:
Figure 4.2 – A class diagram showing FlightTracker and supporting classes
We’ll explore these pieces of code throughout this chapter, but for now, we need to understand that the key responsibilities of FlightTracker
include the following:
- Tracking a list of flights
- Scheduling new flights (adding...