|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectfoodManagement.Food
public class Food
An IMMUTABLE class that represents an item that might be part of an entree
in a restaurant. (For example, Toast or Coffee.)
A food object has a name (String), a wholesale cost measured in pennies (int),
a retail price measured in pennies (int), and a small picture that depicts
the item (java.awt.Image).
Note that the constructor is private, so the only available Food objects
are those that are found in the public static array of Food objects called
FOOD_OBJECTS. (You cannot use "new" to instantiate a Food object, you must
use the ones that are already in the FOOD_OBJECTS array.)
| Field Summary | |
|---|---|
static Food[] |
FOOD_OBJECTS
This array is populated with Food items that are available for use. |
| Method Summary | |
|---|---|
boolean |
equals(Food other)
Checks if the current object is equal to the parameter. |
java.awt.Image |
getImage()
Getter for the Image associated with this food. |
java.lang.String |
getName()
Getter for the name of this food. |
int |
getRetailValue()
Getter for the retail cost of this food, measured in pennies. |
int |
getWholesaleCost()
Getter for the wholesale cost of this food, measured in pennies. |
java.lang.String |
toString()
Returns the name of the food. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Food[] FOOD_OBJECTS
| Method Detail |
|---|
public java.awt.Image getImage()
public java.lang.String getName()
getName in interface Listablepublic int getWholesaleCost()
getWholesaleCost in interface Listablepublic int getRetailValue()
getRetailValue in interface Listablepublic boolean equals(Food other)
other - Food item to be compared with the current object
public java.lang.String toString()
toString in interface ListabletoString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||