The Counter Class
public Counter(int max) {this.max = max;}
public void reset() {val = 0;}
public int getVal() {return val;}
public void setVal(int val) {
if (val >= 0 && val <= max)
public void inc() {if (val < max) val++;}
public void dec() {if (val > 0) val--;}
private int max, val=0; // Instance variables