class Clock { public static void main(String[] args) { Clock one = new Clock("2350"); for (int i = 0; i < 20; i++) { one.tick(); System.out.println(one.report()); } } int hours, minutes; Clock(String time) { hours = Integer.parseInt(time.substring(0, 2)); minutes = Integer.parseInt(time.substring(2)); } void tick() { minutes += 1; if (minutes == 60) { minutes = 0; hours += 1; } if (hours == 24) { hours = 0; } } String report() { String hours = "00" + this.hours; String minutes = "00" + this.minutes; return hours.substring(hours.length() - 2) + ":" + minutes.substring(minutes.length() - 2); } }