Class Sparrow
java.lang.Object
|
+--BasicAnimal
|
+--Sparrow
- All Implemented Interfaces:
- Animal
- public class Sparrow
- extends BasicAnimal
One of several animal types.
Constructor Summary |
Sparrow(java.lang.String theName)
Create a new Sparrow with default characteristics. |
Sparrow(java.lang.String theName,
double serving,
double weight)
Create a new Sparrow, using supplied parameter values. |
Method Summary |
static void |
main(java.lang.String[] args)
Run this animal through a typical day. |
void |
noise()
Provide this animal with an appropriate voice. |
void |
sleep()
Provide this animal with a way to rest when weary. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Sparrow
public Sparrow(java.lang.String theName)
- Create a new Sparrow with default characteristics. This constructor
sets a default meal size of 0.05 pounds and an initial weight
of .1 pounds.
- Parameters:
theName
- name of this animal
Sparrow
public Sparrow(java.lang.String theName,
double serving,
double weight)
- Create a new Sparrow, using supplied parameter values.
- Parameters:
theName
- name of this animalserving
- the size of a single meal for this animal in poundsweight
- the initial weight of this animal in pounds
noise
public void noise()
- Provide this animal with an appropriate voice.
sleep
public void sleep()
- Provide this animal with a way to rest when weary.
- Overrides:
sleep
in class BasicAnimal
main
public static void main(java.lang.String[] args)
- Run this animal through a typical day. This is a simple test harness for this
class.
- Parameters:
args
- ignored