Problem

In this exercise, you modify an existing header file. a. Follow the instructions for s...

In this exercise, you modify an existing header file.

a. Follow the instructions for starting C++ and viewing the Advanced17.cpp and Advanced17 MyDate.h files, which are contained in either the Cpp7\Chap15\Advanced17 Project folder or the Cpp7\Chap15 folder. The program uses the MyDate class to create an object named today. Notice that the program prompts the user to enter the month, day, and year. It then uses the MyDate class’s public methods (setDate and displayDate) to set and display the date entered by the user. The program also uses a public method named updateDate to increase the day number by 1. It then displays the new date on the screen.

b. Run the program. Enter 3 as the month, 15 as the day, and 2014 as the year. The computer screen shows that today is 3/15/2014 and tomorrow is 3/16/2014, which is correct.

c. Run the program again. This time, enter 3 as the month, 31 as the day, and 2015 as the year. The computer screen shows that today is 3/31/2015 and tomorrow is 3/32/2015, which is incorrect.

d. Modify the updateDate method so that it updates the date correctly. For example, if today is 3/31/2015, then tomorrow is 4/1/2015. If today is 12/31/2013, then tomorrow is 1/1/2014. You do not have to worry about leap years; treat February as though it always has 28 days. Save and then run the program. Test the program four times, using the following dates: 3/15/2014, 4/30/2015, 2/28/2011, and 12/31/2013.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 15
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT