Passenger

class Passenger(val name: String, val card: Option[TravelCard])

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

Value parameters:
card

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

name

the passenger’s name

class Object
trait Matchable
class Any

Value members

Concrete methods

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.

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.

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.

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.

Concrete fields