001package edu.pdx.cs410J;
002
003import java.io.Serializable;
004import java.time.ZonedDateTime;
005
006/**
007 * This class represents an airline flight.  Each flight has a unique
008 * number identifying it, an origin airport identified by the
009 * airport's three-letter code, a departure time, a destination
010 * airport identified by the airport's three-letter code, and an
011 * arrival time.
012 */
013public abstract class AbstractFlight implements Serializable {
014
015  /**
016   * Returns a number that uniquely identifies this flight.
017   */
018  public abstract int getNumber();
019
020  /**
021   * Returns the three-letter code of the airport at which this flight
022   * originates.
023   */
024  public abstract String getSource();
025
026  /**
027   * Returns this flight's departure time as a <code>Date</code>.
028   */
029  public ZonedDateTime getDeparture() {
030    return null;
031  }
032
033  /**
034   * Returns a textual representation of this flight's departure
035   * time.
036   */
037  public abstract String getDepartureString();
038
039  /**
040   * Returns the three-letter code of the airport at which this flight
041   * terminates.
042   */
043  public abstract String getDestination();
044
045  /**
046   * Returns this flight's arrival time as a <code>Date</code>.
047   */
048  public ZonedDateTime getArrival() {
049    return null;
050  }
051
052  /**
053   * Returns a textual representation of this flight's arrival time.
054   */
055  public abstract String getArrivalString();
056
057  /**
058   * Returns a brief textual description of this flight.
059   */
060  public final String toString() {
061    return "Flight " + this.getNumber() + " departs " + this.getSource()
062           + " at " + this.getDepartureString() + " arrives " +
063           this.getDestination() + " at " + this.getArrivalString();
064  }
065}