#include using namespace std; int main() { Time mytime; mytime.setTime(2,15,0); cout << "hour = " << mytime.getHour() << endl; cout << "minute = " << mytime.getMinute() << endl; if(mytime.getHour == 2) { if(mytime.getMinute >= 15) { cout << "It's time to leave" << endl; } else { cout << "We have some time left" << endl; } } else { cout << "We have a few minutes left" << endl; } } Time::Time(int hr, int min, int sec) { setTime(hr, min, sec); } void Time::setTime(int h, int m, int s) { setHour(h); setMinute(m); setSecond(s); } void Time::setHour( int h) { if(h >= 0 && h < 24) { hour = h; } else { hour = 0; } } void Time::setMinute(int m) { if(m >= 0 && m < 60) minute = m; else minute = 0; } void Time::setSecond(int s) { if(s >= 0 && s < 60) second = s; else second = 0; } int Time::getMinute() const { return minute; } int Time::getSecond() const { return second; } void Time::printStandard() { if(hour == 12) cout << 12; else cout << hour % 12; cout << ":"; if(minute < 10) cout << 0; cout << minute << ":"; if(second < 10) cout << 0; cout << second; if(hour < 12) cout << " AM"; else cout << " PM"; }