Class Flight


  • public class Flight
    extends Object
    Class representing a flight.
    Author:
    Herbert Praehofer
    • Field Detail

      • from

        public final String from
        The origin of the flight
      • to

        public final String to
        The destination of the flight
      • airline

        public final Airline airline
        The airline
      • flightNumber

        public final String flightNumber
        The flight number
      • departs

        public final LocalDateTime departs
        The date and time of the departure
      • price

        public final int price
        The price of the flight
    • Constructor Detail

      • Flight

        public Flight​(String from,
                      String to,
                      Airline airline,
                      String flightNumber,
                      LocalDateTime departs,
                      int price)
        Constructor creating a flight.
        Parameters:
        from - the origin of the flight
        to - the destination of the flight
        airline - the airline of the flight
        flightNumber - the number of the flight
        departs - the departure date and time of the flight
        price - the price of the flight
    • Method Detail

      • hashCode

        public int hashCode()
        Returns the hash code.
        Overrides:
        hashCode in class Object
        Returns:
        the hash code
      • equals

        public boolean equals​(Object obj)
        Indicates if this object is equal to the provided object.
        Overrides:
        equals in class Object
        Parameters:
        obj - the other object
        Returns:
        true if this object is equal to the provided object
      • toString

        public String toString()
        Returns a string representation of the flight
        Overrides:
        toString in class Object