class Experience extends AnyRef
The class Experience
represents entries in a user's experience diary.
Each entry represents an experience as evaluated by the diarist.
An experience object is immutable once created; there are no methods to change any of its attributes.
- Alphabetic
- By Inheritance
- Experience
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Experience(name: String, description: String, price: Double, rating: Int)
- name
a name that identifies the experience, such as "Hotel Anna, Helsinki" or "Sangre de Toro 2007"
- description
the diarist's description of the experience, such as "Nice but unremarkable"
- price
the price (per unit) in euros
- rating
a rating given by the diarist to the experience (from 1 to 10 or on some other scale)
Value Members
- def chooseBetter(another: Experience): Experience
Compares two experiences --- this one and the one given as a parameter --- and returns the one with the higher rating.
Compares two experiences --- this one and the one given as a parameter --- and returns the one with the higher rating. If both have the same rating, arbitrarily returns one of the two.
- val description: String
- def isBetterThan(another: Experience): Boolean
Returns
true
if the experience has a higher rating than the experience given as a parameter, andfalse
otherwise. - val name: String
- val price: Double
- val rating: Int
- def valueForMoney: Double
Returns the "value for money" for the experience.
Returns the "value for money" for the experience. Value for money equals the experience's rating divided by its price.