|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Flight
public class Flight
Information about one flight on the airline. A flight has a number, arrival and departure Airports, arrival and departure times, and a duration. Flights can be compared based on departure time.
Arrival and departure times are encoded as four digit integers where the first two digits represent hours and the last two represent minutes. For example, 100 is 1:00AM, 1300 is 1:00PM, 17:58 is 5:58PM. If a flight lands after midnight, the hours may be larger than 24.
The duration of a flight is minutes. Note that because of time zone changes, adding the duration to the departure time will not always give you the arrival time. For example, if a flight leaves LA and 8:00AM and takes 6 hours to fly to NY, the duration is 360 minutes, but the arrival time is 5:00PM.
Field Summary | |
---|---|
protected Airport |
arrives
arrival airport |
protected int |
arriveTime
arrival time (in 24 hour time as 4 digits, ie 1530 for 130pm) |
protected Airport |
departs
departure airport |
protected int |
departTime
departure time (in 24 hour time as 4 digits, ie 1530 for 330pm) |
protected int |
duration
duration of the flight (in minutes) |
protected int |
number
flight number |
Constructor Summary | |
---|---|
Flight(int number,
Airport departs,
Airport arrives,
int departTime,
int arriveTime,
int duration)
|
Method Summary | |
---|---|
Airport |
arrives()
|
int |
arriveTime()
|
int |
compareTo(Flight o)
|
Airport |
departs()
|
int |
departTime()
|
int |
duration()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int number
protected Airport departs
protected Airport arrives
protected int departTime
protected int arriveTime
protected int duration
Constructor Detail |
---|
public Flight(int number, Airport departs, Airport arrives, int departTime, int arriveTime, int duration)
Method Detail |
---|
public int departTime()
public int arriveTime()
public Airport departs()
public Airport arrives()
public int duration()
public int compareTo(Flight o)
compareTo
in interface Comparable<Flight>
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |