|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--BasicAnimal
The base class for several types of Animals. Does not implement the noise method of the Animal interface, hence must be abstract.
| Field Summary | |
protected double |
currentWeight
the weight of this animal in pounds. |
protected double |
mealSize
the serving size of one meal for this animal in pounds. |
protected java.lang.String |
name
the name of this animal. |
| Constructor Summary | |
BasicAnimal(java.lang.String theName,
double serving,
double weight)
Create a new BasicAnimal, using supplied parameter values. |
|
| Method Summary | |
void |
eat(double pounds)
Eat some goodies. |
double |
getMealSize()
get the meal size defined for this animal. |
void |
sleep()
Provide this animal with a way to rest when weary. |
java.lang.String |
toString()
print information about this animal. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface Animal |
noise |
| Field Detail |
protected double mealSize
protected double currentWeight
protected java.lang.String name
| Constructor Detail |
public BasicAnimal(java.lang.String theName,
double serving,
double weight)
theName - name of this animalserving - the size of a single meal for this animal in poundsweight - the initial weight of this animal in pounds| Method Detail |
public void sleep()
sleep in interface Animalpublic void eat(double pounds)
eat in interface Animalpounds - the number of pounds of food provided.public double getMealSize()
getMealSize in interface Animalpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||