animals
Class Cat

java.lang.Object
  extended by animals.Cat

public class Cat
extends java.lang.Object

A domestic Cat which has a name, may be hungry, and eats Bunnys.

This class is very stupid; its instance variables (aka fields) are public.


Field Summary
 boolean hungry
          is the cat hungry true or not hungry false
 java.lang.String name
          Cat's given name
 
Constructor Summary
Cat()
           
 
Method Summary
 void eat(Bunny food)
          eat a Bunny, changing its name to Ex-Bunny.
 void miaow()
          The cat makes a noise.
 java.lang.String toString()
          Generate what we get if we cast Cat to String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public java.lang.String name
Cat's given name


hungry

public boolean hungry
is the cat hungry true or not hungry false

Constructor Detail

Cat

public Cat()
Method Detail

miaow

public void miaow()
The cat makes a noise.


eat

public void eat(Bunny food)
eat a Bunny, changing its name to Ex-Bunny. Thereafter the Cat is no longer hungry.

ex: cat1.eat(bunny1);

Parameters:
food - the Bunny to be eaten by the Cat

toString

public java.lang.String toString()
Generate what we get if we cast Cat to String

Overrides:
toString in class java.lang.Object
Returns:
a string representing the cat