Question: **using c++** 1)Modify the Data class defined below to include a nextDay() function that increments a date by one day. Test your function to ensure

**using c++**

1)Modify the Data class defined below to include a nextDay() function that increments a date by one day. Test your function to ensure that it increments days into a new month and into a new year correctly.

2)Modify the Date class defined below to include a priorDay() function that decrements a date by one day. Test your function to ensure that it decrements days into a prior month and into a prior year correctly

3)Modify the Date class in below to contain a method that compares two Date objects and returns the larger of the two. The method should be written according to the following algorithm:

Comparison function

Accept two Date values as parameters

Determine the later date by using the following procedure:

Convert each date into an integer value having the form yyyymmdd

This can be accomplished by using the formula year * 100000 + month * 100 + day

Compare the corresponding integers for each date. The larger integer corresponds to the later date. Return the later date

#include

using namespace std;

//class declaration section

class Date

{

private:

int month;

int day;

int year;

public:

void setDate(int, int, int);

void showDate();

};

//class implementation section

void Date::setDate(int mm, int dd, int yyyy)

{

month = mm;

day = dd;

year = yyyy;

return;

}

void Date::showDate()

{

cout << "The date is"<

cout << month << '/';

cout << day << '/';

cout << year % 100 ;

cout <<

endl;

return;

}

int main()

{

Date a, b, c ; //declare 3 objects

b.setDate(8,1,2018); //assign values to b's data members

a.showDate();

//display object a'values

b.showDate();

//display object b'values

c.showDate();

//display object c'values

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!