package InheritanceDemo;

/**
 * Animal.java
 *
 *
 * Created: Mon Feb  5 14:38:23 2001
 *
 * @author <a href="mailto: "Stuart C. Shapiro</a>
 */

abstract public class Animal {
    /** The name of this animal. */
    protected String name;

    /** This animal's appetite */
    private Appetite appetite;

    /** The food this animal eats. */
    protected String food = "food";

    /**
     * Constructs an animal with the given name, and an appetite.
     * @param nme This animal's name.
     */
    public Animal (String nme){
	name = nme;
	appetite = new Appetite(this);
    }

    /**
     * Returns this animal's appetite.
     */
    public Appetite getAppetite(){
	return appetite;
    }

    /** Prints a message giving this animal's name. */
    public void identify(){
	System.out.print("I am " + this + " ");
    }


    public String toString(){
	return name;
    }

    /** Prints a message showing this animal moving. */
    abstract public void move();

    /** Prints a message showing this animal speaking. */
    abstract public void speak();

    /** Prints a message asking for food. */
    public void beg(){
	System.out.print("Give me " + food + " ");
    }

    /** Causes this animal to exhibit its behaviors. */
    public void behave(){
	move(); speak(); identify(); beg();
	System.out.println();
    }
}// Animal
