public class Clock { private int h, m, s; /** * adds 1 s to the current time */ public Clock tick() { s += 1; if (s == 60) { m += 1; s = 0; if (m == 60) { m = 0; h += 1; } } return this; } /** * Prints the time of the clock */ public void printTime() { System.out.println(h + "h " + m + "mn " + s + "s"); } }