package rebelsky.fractions; /** * A simple counter. * * @author Samuel A. Rebelsky * @version 1.0 of September 2005 */ public class Counter { // +--------------+------------------------------------------------------ // | Class Fields | // +--------------+ // +--------+------------------------------------------------------------ // | Fields | // +--------+ /** * The count. */ int count; // +--------------+------------------------------------------------------ // | Constructors | // +--------------+ /** * Create a new counter which starts at 0. */ public Counter() { this.count = 0; } // Counter() // +---------+----------------------------------------------------------- // | Methods | // +---------+ /** * Add one to the count. */ public void increment() { this.count = this.count + 1; } // increment() /** * Get the count. */ public int get() { return this.count; } // get() // +---------------+----------------------------------------------------- // | Class Methods | // +---------------+ } // class Counter