Class FlightSchedule

java.lang.Object
|
+--FlightSchedule

public class FlightSchedule
extends java.lang.Object

FlightSchedule stores the amount of Money it will cost to fly from one city to another city.


Field Summary
static int NUM_CITIES
          The number of cities stored in this FlightSchedule.
 
Constructor Summary
FlightSchedule()
          Creates a new FlightSchedule object.
 
Method Summary
 java.lang.String[] getAllCities()
          Returns all cities in the FlightSchedule.
 Money getFare(java.lang.String gateway, java.lang.String destination)
          Returns the fare to fly from the gateway to the destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUM_CITIES

public static final int NUM_CITIES
The number of cities stored in this FlightSchedule.

Constructor Detail

FlightSchedule

public FlightSchedule()
Creates a new FlightSchedule object.

Method Detail

getFare

public Money getFare(java.lang.String gateway,
java.lang.String destination)
Returns the fare to fly from the gateway to the destination.
If the cities do not exisit in the FlightSchedule, or there is no flight available from the gateway city to the destination city, then the returned fare will be null.

Parameters:
gateway - the city where the flight will take off from
destination - the city where the flight will land in
Returns:
the amount of Money to fly from the gateway to the destination, null if there is no flight in the FlightSchedule from the gateway to the destination

getAllCities

public java.lang.String[] getAllCities()
Returns all of the cities in the FlightSchedule.
All listed cities are the gateway or the destination for at least one flight in the FlightSchedule.

Returns:
a list of all cities in the FlightSchedule