// BunchOfGrapes.java // NOTE: None of the methods are static! public class BunchOfGrapes { public int numGrapes; public boolean isWashed; // Constructor: create a new bunch of grapes // Input: How many grapes are in the bunch // Output: none! Creating a new object. // NOTE: This method is not static! public BunchOfGrapes(int grapes) { numGrapes = grapes; // Default: not washed isWashed = false; } // eatGrape: Get a grape from a bunch and eat it // Input: none // Output: none // This is known as an "update" method. public void eatGrape() { numGrapes--; System.out.print("Yum, ate a grape. "); System.out.println(numGrapes + " left in this bunch."); } // This is also an "update" method. public void wash() { isWashed = true; System.out.println("This bunch is now clean!"); } // This is known as an "accessor" method. public boolean isClean() { return isWashed; } }