// 22.5HV2 Software Engineering II // Unit 2 Exercise 2 import java.io.*; public class Alarm_clock { public Alarm_clock(int h, int m, int s) { hour = h; minute = m; second = s; } public void tick() { minute += (second+1)/60; hour += minute/60; minute %= 60; hour %= 24; second = (second+1)%60; if ( on && hour==alarm_h && minute==alarm_m) System.out.println("GET UP!!!"); } public void show_time() { System.out.println(hour+":"+minute+":"+second); } public void set_alarm() { System.out.println("Enter time (24h)"); alarm_h=console.readint(); alarm_m = console.readint(); on = true; } private int hour, minute, second; private int alarm_h, alarm_m; private boolean on; };