Question
Design a class called Date that has integer data members to store month, day, and year. The class should have a three-parameter (day-of-month, month, year)
Design a class called Date that has integer data members to store month, day, and year. The class should have a three-parameter (day-of-month, month, year) default constructor that allows the date to be set at the time a new Date object is created. If the user creates a Date object without passing any arguments , or if any of the values passed are invalid, the default values of 1, 1, 2001 (i.e., January 1, 2001) should be used (see below for the definition of invalid values ). The class should have member functions to print the date in the following formats:
3/15/13 (printNumerical)
March 15, 2013 (printMonthFirst)
15 March 2013 (printDateFirst)
For the purposes of this exercise, the following are invalid values :
For day of month: any value less than 1 or greater than 31 (so February 30 or April 31 would be acceptable)
For month: any value less than 1 or greater than 12
For year: any value less than 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started