The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
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!
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll