Miscellaneous Docs
Fall 2026
API

# Passenger

o1.people.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.

## Parameters

card

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

name

  the passenger’s name

## Attributes

Graph
Supertypes
  class Object
  trait Matchable
  class Any

## Members list

### Value members

#### Concrete methods

def canTravel: Boolean

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`.

## Attributes

def hasCard: Boolean

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.

## Attributes

#### Concrete fields

val card: Option[TravelCard]
val name: String