{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

week_6_lab - #include using namespace std class...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 #include <iostream> using namespace std class Time { public: void setHour(int) void getMinute (int) int getHour() int getMinute() void printTime () Time () Time (int, int) private: int hour int minute } Time::Time() //default constructor sets the hour and minute to 0 { hour = 0 minute = 0 } Time::Time (int hr, int min) { hr = hour min = minute } void Time::setHour (int hr) { if (0 <= hr && hr < 24) hr = hour } void Time::setMinute (int min) { if (0 <= min && min < 60) min = minute else minute = 0 } int Time::getHour() { return hour } int Time::getMinute()
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Sheet1 Page 2 { return minute } void Time::printTime() { cout<<getHour()<<":"<<getMinute() } //Set Class date class date { public: void setMonth(int) void setDay(int) void setYear(int) int getMonth() int getDay() int getYear() void printDate() Date() Date (int, int, int) private: int month int day int year } Date::Date() { month = 1 day = 01 year = 2000 } Date::Date (int num, int dd, int yyy) { mmm = month dd = day yyy = year } void Date::setMonth (int mmm) { if (1 <= mmm && mmm <= 12) mmm = month else month = 1 }
Background image of page 2
Sheet1 Page 3 void Date::setDay (int dd) { if (1 <= dd && dd <= 31) dd = day else day = 1 } void Date::setYear (int yyyy) {
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}