Animal

public abstract class Animal
{
	private int position;
	private String name;
	
	public abstract void speak();
	
	public void eat()
	{
		Cookie myCookie = new Cookie();
		while( !(myCookie.isGone()) )
		{
			takeABite( myCookie );
		}
	}
				
	private void takeABite( Cookie cookieObject )
	{
		cookieObject.setHealth(
		    cookieObject.get_health() - 1 );
	}
					
	public void move( boolean toTheLeft )
	{
		if ( toTheLeft )
		{
			position -= 1;
		}
		else
		{
			position++;
		}
	}
}
					
Cat

public class Cat extends Animal
{
	public Cat()
	{
		this( name );
	}
					
	public Cat( String name )
	{
		position = 0;
		this.name = name;
	}

	// implements speak() from Animal class
	public void speak()
	{
		print("Meow");
	}
}
					
Dinosaur

public class Dinosaur extends Animal
{
	private boolean keepEating;
		
	public Dinosaur()
	{
		position = 0;
		keepEating = true;
		name = "Puff";
	}
						
	public Dinosaur( String name )
	{
		this.name = name;
		position = 0;
		keepEating = true;
	}

	public void eat()
	{
		Cookie myCookie = new Cookie();
		while( !(myCookie.isGone()) )
		{
			takeABite( myCookie );
		}				
	}
			
	private void takeABite( Cookie cookieObject )
	{
		cookieObject.setHealth(
		    cookieObject.get_health() - 1 );
	}
						
	public void stopEating()
	{
		keepEating = false;
	}
						
}
					
Dog

public class Dog extends Animal
{
	public Dog()
	{
		position = 0;
		name = "Fido";
	}
						
	public Dog(name)
	{
		position = 0;
		this.name = name;
	}
			
	// implements speak() from Animal class
	public void speak()
	{
		print("Arff");
	}
}