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.

Value parameters:
number

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

orderer

the customer that placed the order

class Object
trait Matchable
class Any

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.

Value parameters:
numberOfUnits

the number of identical items that are added

pricePerUnit

the price of an individual item of the added product type

override def toString: String

Returns a textual description of the order.

Returns a textual description of the order.

Definition Classes

Concrete fields

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

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

val number: Int