// Inheritance: design practice
// Solution: Fruit class

public class Fruit
{
	private int numBitesLeft;

	public Fruit(int nBites)
	{
		numBitesLeft = nBites;
	}

	// If there are bites left, eat it. (return 0)
	// Otherwise, return 1.
	public int eat()
	{
		if (numBitesLeft>0) { numBitesLeft--; return 0; }
		return 1;
	}

	public boolean eatable()
	{
		return numBitesLeft > 0;
	}
	
	public String toString()
	{
		return "  It has " + numBitesLeft + " bites left.";
	}
}

