IntroOOP Docs
Fall 2026
API

# Order

o1.classes.Order
class Order(val `number`: Int, val `orderer`: Customer)

Class `Order` represents orders of zero or more products (in an imaginary and way simplified online store). This simple implementation does not record every individual instance of a product added to the order, only the total price of the added products.

## Parameters

number

  a number that uniquely identifies the order (a positive integer)

orderer

  the customer that placed the order

## Attributes

Graph
Supertypes
  class Object
  trait Matchable
  class Any

## Members list

### Value members

#### Concrete methods

def addProduct(`pricePerUnit`: Double, `numberOfUnits`: Int): Unit

Adds a number of products to the order, as indicated by the parameters. In practice, what this means is that the total price of the order increases by the total price of the newly added products.

Adds a number of products to the order, as indicated by the parameters. In practice, what this means is that the total price of the order increases by the total price of the newly added products.

## Parameters

numberOfUnits

  the number of identical items that are added

pricePerUnit

  the price of an individual item of the added product type

## Attributes

override def toString: String

Returns a textual description of the order.

Returns a textual description of the order.

## Attributes

Definition Classes
  Any

#### Concrete fields

var isExpress: Boolean

whether exceptionally fast delivery has been requested (`true`) or not (`false`)

whether exceptionally fast delivery has been requested (`true`) or not (`false`)

## Attributes

val number: Int
val orderer: Customer