o1.people

package o1.people

Type members

Classlikes

class Member(val id: Int, val name: String, val yearOfBirth: Int, val yearOfDeath: Option[Int])

Each instance of class Member represents an individual person, recorded by an (imaginary) society-membership app. A member has a number of basic attributes such as a name and a year of birth.

Each instance of class Member represents an individual person, recorded by an (imaginary) society-membership app. A member has a number of basic attributes such as a name and a year of birth.

Once created, a Member object is immutable; to represent changes in a person, one should create a new instance of the class.

Value parameters:
id

a number that uniquely identifies the member from other members of the society

name

the member’s name

yearOfBirth

the year the member was born

yearOfDeath

the year the member died (wrapped in an Option; None if the member is alive)

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

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

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 TravelCard(val id: Int)

A TravelCard object represents a travel card meant for accessing public transportation. A travel card may be valid or invalid; a card’s status can be set as invalid, if the allocated time expires or if the card is stolen, for instance.

A TravelCard object represents a travel card meant for accessing public transportation. A travel card may be valid or invalid; a card’s status can be set as invalid, if the allocated time expires or if the card is stolen, for instance.

Value parameters:
id

a number that identifies the travel card from others