Below is the interface for the Date class: it is our "contract" with you: you have to implement everything it describes, and show us that it works with a test harness that puts it through its paces. The comments in the interface below should be sufficient for you to understand the project (use these comments in your Date declaration), without the need of any further documentation. But of course, as always, you can ask us questions on the discussion boards. class Date { private: unsigned day; unsigned month; string monthName; unsigned year; public: // creates the date January 1st, 2000. Date(); /* parameterized constructor: month number, day, year - e.g. (3, 1, 2010) will construct the date March 1st, 2010 If any of the arguments are invalid (e.g. 15 for month or 32 for day) then the constructor will construct instead a valid Date as close as possible to the arguments provided - e.g. in above example, Date (15, 32, 2010), the Date would be corrected to Dec 31st, 2010.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Can I please get a help in solving this question? 

 

10.15 Program 4: Date Class
Problem Definition
Build a Date class and a main function to test it.
Specifications
Below is the interface for the Date class: it is our "contract" with you: you have to implement everything it describes, and show us that it
works with a test harness that puts it through its paces. The comments in the interface below should be sufficient for you to
understand the project (use these comments in your Date declaration), without the need of any further documentation. But of course,
as always, you can ask us questions on the discussion boards.
class Date
{
private:
unsigned day;
unsigned month;
string monthName;
unsigned year;
public:
// creates the date January 1st, 2000.
Date();
/* parameterized constructor: month number, day, year
- e.g. (3, 1, 2010) will construct the date March 1st, 2010
If any of the arguments are invalid (e.g. 15 for month or 32 for day)
then the constructor will construct instead a valid Date as close
as possible to the arguments provided e.g. in above example,
Date (15, 32, 2010), the Date would be corrected to Dec 31st, 2010.
of such invalid innut the
ructor will issue
In
Transcribed Image Text:10.15 Program 4: Date Class Problem Definition Build a Date class and a main function to test it. Specifications Below is the interface for the Date class: it is our "contract" with you: you have to implement everything it describes, and show us that it works with a test harness that puts it through its paces. The comments in the interface below should be sufficient for you to understand the project (use these comments in your Date declaration), without the need of any further documentation. But of course, as always, you can ask us questions on the discussion boards. class Date { private: unsigned day; unsigned month; string monthName; unsigned year; public: // creates the date January 1st, 2000. Date(); /* parameterized constructor: month number, day, year - e.g. (3, 1, 2010) will construct the date March 1st, 2010 If any of the arguments are invalid (e.g. 15 for month or 32 for day) then the constructor will construct instead a valid Date as close as possible to the arguments provided e.g. in above example, Date (15, 32, 2010), the Date would be corrected to Dec 31st, 2010. of such invalid innut the ructor will issue In
*
If any of the arguments are invalid (e.g. 15 for month or 32 for day)
then the constructor will construct instead a valid Date as close
as possible to the arguments provided e.g. in above example,
Date (15, 32, 2010), the Date would be corrected to Dec 31st, 2010.
In case of such invalid input, the constructor will issue a console error message:
*/
Date (unsigned m, unsigned d, unsigned y);
-
Invalid date values: Date corrected to 12/31/2010.
(with a newline at the end).
*/
parameterized constructor: month name, day, year
e.g. (December, 15, 2012) will construct the date December 15th, 2012
If the constructor is unable to recognize the string argument as a valid month name,
then it will issue a console error message:
Invalid month name: the Date was set to 1/1/2000.
(with a newline at the end).
If the day argument is invalid for the given month (but the month name was valid),
then the constructor will handle this error in the same manner as the other
parameterized constructor.
This constructor will recognize both "december" and "December"
as month name.
*/
Date (const string &mn, unsigned d, unsigned y);
/* Outputs to the console (cout) a Date exactly in the format "3/1/2012".
Does not output a newline at the end.
Transcribed Image Text:* If any of the arguments are invalid (e.g. 15 for month or 32 for day) then the constructor will construct instead a valid Date as close as possible to the arguments provided e.g. in above example, Date (15, 32, 2010), the Date would be corrected to Dec 31st, 2010. In case of such invalid input, the constructor will issue a console error message: */ Date (unsigned m, unsigned d, unsigned y); - Invalid date values: Date corrected to 12/31/2010. (with a newline at the end). */ parameterized constructor: month name, day, year e.g. (December, 15, 2012) will construct the date December 15th, 2012 If the constructor is unable to recognize the string argument as a valid month name, then it will issue a console error message: Invalid month name: the Date was set to 1/1/2000. (with a newline at the end). If the day argument is invalid for the given month (but the month name was valid), then the constructor will handle this error in the same manner as the other parameterized constructor. This constructor will recognize both "december" and "December" as month name. */ Date (const string &mn, unsigned d, unsigned y); /* Outputs to the console (cout) a Date exactly in the format "3/1/2012". Does not output a newline at the end.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Development strategies
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education