1  /**
  2     This class models a tally counter.
  3  */
  4  public class Counter
  5  {
  6     private int value;
  7  
  8     /**
  9        Gets the current value of this counter.
 10        @return the current value
 11     */
 12     public int getValue()
 13     {
 14        return value;
 15     }
 16  
 17     /**
 18        Advances the value of this counter by 1.
 19     */
 20     public void click() 
 21     {
 22        value = value + 1;
 23     }
 24  
 25     /**
 26        Resets the value of this counter to 0.
 27     */
 28     public void reset()
 29     {
 30        value = 0;
 31     }
 32  }