Packages

c

o1.people

Passenger

class Passenger extends AnyRef

Each instance of class Passenger represents an individual passenger in an imaginary traffic-related application.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Passenger
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Passenger(name: String, card: Option[TravelCard])

    name

    the passenger's name

    card

    a travel card associated with the person, if there is one; None indicates that there isn't

Value Members

  1. def canTravel: Boolean

    Determines whether a valid travel card is associated with the person or not.

    Determines whether a valid travel card is associated with the person or not. That is, the person must have a travel card and the card's isValid method must return true.

  2. val card: Option[TravelCard]
  3. def hasCard: Boolean

    Determines whether the person is associated with a travel card or not.

    Determines whether the person is associated with a travel card or not. As long as the person has a card, the method returns true even if the card is invalid.

  4. val name: String