In this exercise, you modify an existing header file. a. Follow the instructions for starting C++ and

Question:

In this exercise, you modify an existing header file. 

a. Follow the instructions for starting C++ and viewing the Advanced18.cpp and Advanced18 MyDate.h files, which are contained in either the Cpp8\Chap15\ Advanced18 Project folder or the Cpp8\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 2016 as the year. The computer screen shows that today is 3/15/2016 and tomorrow is 3/16/2016, which is correct. 

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

d. Modify the updateDate method so that it updates the date correctly. For example, if today is 3/31/2016, then tomorrow is 4/1/2016. If today is 12/31/2017, then tomorrow is 1/1/2018. 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/2016, 4/30/2017, 2/28/2017, and 12/31/2016.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: