/** * A simple model of a clock * * @author CSC 142 * */ public class Clock { private int h, m, s; /** * Adds 1 second to the current time * * @return the clock object */ public Clock tick() { s++; if (s == 60) { m++; s = 0; if (m == 60) { h++; m = 0; } } return this; } /** * Returns a string description of the clock */ public String toString() { return "h = " + h + ", m = " + m + ", s = " + s; } }