/** * Description: counts integers * * @author Bhaskaran Raman * @version 30 Dec 2004 */ class Counter { /** Object variable: to maintain the counter */ int x; /** * Constructor for objects of class Counter */ Counter() { // initialise the counter x = 0; } int getCurrentValue() { return x; } /** * Add a value * * @param y to be added to x */ void add(int y) { x = x+y; } /** Add one to 'x' */ void increment() { x = x+1; } }