Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

question :write a program in which you required to incrementthe class date . hin

ID: 3612089 • Letter: Q

Question

question :write a program in which you required to incrementthe class date . hints:      *    write aclass date wich contain (int day ,month ,year ) and incrementthe date in a way that the year month and the day alsochange.     *     using operatorover loadig . question :write a program in which you required to incrementthe class date . hints:      *    write aclass date wich contain (int day ,month ,year ) and incrementthe date in a way that the year month and the day alsochange.     *     using operatorover loadig .

Explanation / Answer

{
os << rhs.day << "-" << rhs.month<< "-" << rhs.year;
return os;
}
Date operator+( int numDays, const Date& rhs )

{
return rhs + numDays;
}
Date::Date( int d ) :
day(d), month(0), year(0)

{
// nothing
}
Date::Date( int d, int m, int y ) :
day(d), month(m), year(y)

{
// nothing
}
void Date::print() const

{
cout << day << "-" << month <<"-" << year << ' ';
}
Date& Date::operator++()

{
int maxDays = getMaxDays(month);
++day;
if( day > maxDays ) {
day = 1;
++month;
if( month > 12 ) {
++year;
month = 1;
}
}
return *this;
}
Date Date::operator++( int dummy )

{
Date result = *this;
++(*this);
return result;
}
Date Date::operator+( int numDays ) const {
Date result = *this;
for( int i = 0; i < numDays; ++i )