Class Dog

java.lang.Object
  |
  +--Dog
All Implemented Interfaces:
Acrobat

public class Dog
extends java.lang.Object
implements Acrobat

One of several animal types, in this case, a canine. This class of Dogs is special because it can also do Acrobat functions.


Constructor Summary
Dog(java.lang.String theName)
          Create a new Dog with default characteristics.
Dog(java.lang.String theName, double serving, double weight)
          Create a new Dog, using supplied parameter values.
 
Method Summary
 void clap(int k)
          Clap as instructed.
 void eat(double pounds)
          Eat some goodies.
 int getActionCount()
          Tell the caller how many things we've done so far.
 double getCurrentWeight()
          get the current weight of this animal.
 double getMealSize()
          get the meal size defined for this animal.
 java.lang.String getName()
          get the name of this animal.
 void twirl(int k)
          Twirl around as instructed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dog

public Dog(java.lang.String theName)
Create a new Dog with default characteristics. This constructor sets a default meal size of 1 pound and an initial weight of 40 pound.

Parameters:
theName - name of this animal

Dog

public Dog(java.lang.String theName,
           double serving,
           double weight)
Create a new Dog, using supplied parameter values.

Parameters:
theName - name of this animal
serving - the size of a single meal for this animal in pounds
weight - the initial weight of this animal in pounds
Method Detail

eat

public void eat(double pounds)
Eat some goodies. There is some weight gain after eating.

Parameters:
pounds - the number of pounds of food provided.

getMealSize

public double getMealSize()
get the meal size defined for this animal.

Returns:
meal size in pounds

getCurrentWeight

public double getCurrentWeight()
get the current weight of this animal.

Returns:
weight in pounds

getName

public java.lang.String getName()
get the name of this animal.

Returns:
the name

twirl

public void twirl(int k)
Twirl around as instructed.

Specified by:
twirl in interface Acrobat
Parameters:
k - the number of times to twirl

clap

public void clap(int k)
Clap as instructed.

Specified by:
clap in interface Acrobat
Parameters:
k - the number of times to clap

getActionCount

public int getActionCount()
Tell the caller how many things we've done so far.

Specified by:
getActionCount in interface Acrobat
Returns:
the number of claps and twirls to date