The class Category represents categories of experiences in the GoodStuff diary application. A single category contains zero or more experiences that are similar in some way and are purchased in units of the same kind. A category object could be used represent hotel experiences, for instance, or wines the diarist has tasted.
A category object has a mutable state: A newly created category has no experiences yet; experiences must be added to it using the addExperience method.
Parameters
name
the name of the category, such as "Hotel" or "Wine"
unit
the name of the pricing unit associated with the experiences in this category, such as "night" or "bottle"
Returns the experience that the user has rated the highest in this category. That is, of all the experiences added into this category so far, returns the one with the highest rating. If there is a tie for first place, the experience recorded first is returned.
Returns the experience that the user has rated the highest in this category. That is, of all the experiences added into this category so far, returns the one with the highest rating. If there is a tie for first place, the experience recorded first is returned.