// 22.5HV2 Software Engineering II // Unit 2 Exercise 2 #include #include #include "Alarm.h" Alarm_clock::Alarm_clock(int h=0, int m=0, int s=0): hour(h), minute(m), second(s) { on = false;} void Alarm_clock::tick() { minute += (second+1)/60; hour += minute/60; minute %= 60; hour %= 24; second = (second+1)%60; if ( on && hour==alarm_h && minute==alarm_m) cout << "GET UP!!!" << endl; } void Alarm_clock::show_time() { cout << setfill('0') << setw(2) << hour; cout << ":" << setw(2) << minute << ":" << setw(2) << second << endl; } void Alarm_clock::set_alarm() { cout << "Enter time (24h): "; cin >> alarm_h >> alarm_m; on = true; }