// Counter.java - a simple wrap around counter public class Counter { //instance variables -fields -- hidden private int value; // Constructor Counter(){value = 0;}; Counter(int v) throws CounterOutOfRangeException { if(v<0 || v>=100) throw new CounterOutOfRangeException("Invalid initial value."); else value = v%100; } //methods -- exposed public void reset() { value = 0; } public int get() { return value;} public void click() {value = (value + 1) % 100;} }