Class Fly

java.lang.Object
  extended by Thing
      extended by Creature
          extended by Fly
All Implemented Interfaces:
Flyer

public class Fly
extends Creature
implements Flyer

Fly is a creature that knows how to fly.


Constructor Summary
Fly(java.lang.String name)
          Create a Fly with a name.
 
Method Summary
 void eat(Thing aThing)
          A Fly eats only Things; a fly will not eat anything that is a Creature.
 void fly()
          When asked to fly, a Fly prints the message '{name} {class} is buzzing around in flight.' (the single quotes are not part of the message.)
 void move()
          When asked to move, a Fly flies.
 
Methods inherited from class Creature
whatDidYouEat
 
Methods inherited from class Thing
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Fly

public Fly(java.lang.String name)
Create a Fly with a name.

Parameters:
name - -- the given name of this Fly
Method Detail

eat

public void eat(Thing aThing)
A Fly eats only Things; a fly will not eat anything that is a Creature. If told to eat a Creature instance, a Fly says: '{name} {class} won't eat a {aThing}.' (the single quotes are not part of the message.) Otherwise a fly eats the thing just like any other Creature would.

Overrides:
eat in class Creature
Parameters:
aThing - -- what this is told to eat

move

public void move()
When asked to move, a Fly flies. That is, the instance calls its own fly() method.

Specified by:
move in class Creature

fly

public void fly()
When asked to fly, a Fly prints the message '{name} {class} is buzzing around in flight.' (the single quotes are not part of the message.)

Specified by:
fly in interface Flyer