class Passenger extends AnyRef
Each instance of class Passenger
represents an individual passenger in an
imaginary traffic-related application.
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- Passenger
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Instance Constructors
- 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
- 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 returntrue
. - val card: Option[TravelCard]
- 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. - val name: String