|
||||||||||
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.
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. |
static void |
main(java.lang.String[] args)
Run this animal through a typical day. |
void |
noise()
Provide this animal with a voice. |
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 |
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 poundsMethod Detail |
public void noise()
noise
in interface Animal
public void sleep()
sleep
in interface Animal
public void eat(double pounds)
eat
in interface Animal
pounds
- the number of pounds of food provided.public double getMealSize()
getMealSize
in interface Animal
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- ignored
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |