/** * This class increments a counter. * * @author cs161 * @version 2/8/17 */ public class Counter{ //Instance variables private final int MAX_VALUE = 9999; private int currentValue; /** * Creates a new counter variable */ public Counter(){ currentValue = 0; } /** * Increments the counter by 1 * @return the new value of the counter */ public int increase(){ currentValue++; // currentValue = currentValue + 1; return currentValue; } /** * Resets the tally back to 0 */ public void resetTally(){ currentValue = 0; } /** * Return the current value of the counter * @return the current value of the counter */ public int getCurrentValue(){ return currentValue; } /** * Returns a string summarizing the state of the counter * @return A string summarizing the state of the counter */ public String toString(){ String stateOfCounter = "[currentValue: " + currentValue + "]"; return stateOfCounter; } }