Write a program in C++ A default constructor that initializes a date object to 0
ID: 641265 • Letter: W
Question
Write a program in C++
A default constructor that initializes a date object to 01-01-1900.
A class constructor that initializes a date object to a correct value using three integer
parameters corresponding to the desired month, day and year.
The function toString() that returns the string version of a date object. For example,
applying toString() to the date 12-01-2000 produces "December 1st, 2000".
The function nextDate() that returns the successive date i.e. the new value of the
date object. For example, applying nextDate() to the date 12-31-2000 produces a
new date: 01-01-2001. You should take into account if the year is a leap year or not.
A leap year is: (1) divisible by 400 or (2) divisible by 4 and not divisible by 100.
A simple run of the driver program follows.
Enter a new date using the format mm-dd-yyyy: 12-31-2000
The string version of the date is: December 31st, 2000
The next date in string version is: January 1st, 2001
Do you want to continue [Y/N]: Y
Enter a new date using the format mm-dd-yyyy: 02-28-2004
The string version of the date is: February 28th, 2004
The next date in string version is: February 29th, 2004
Do you want to continue [Y/N]: Y
Enter a new date using the format mm-dd-yyyy: 34-03-2015
Incorrect!
Enter a new date using the format mm-dd-yyyy: 03-03-2015
The string version of the date is: March 3rd, 2015
The next date in string version is: March 4th, 2015
Do you want to continue [Y/N]: N
Good bye!
Explanation / Answer
Hey i can help you with this. Contact me on hunain60 at gmail
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.