Question: In C + + write a class called Date that has the following member variables: month : an int data to hold month day :
In C write a class called Date that has the following member variables:
month : an int data to hold month
day : an int data to hold day
year : an int data to hold year and it will be digits.
In addition, the class should have the following constructors and member
functions
Constructor : will month to day to and year to
Constructor : an overload of the Constructor above but this time, the
values for month, day and year will be provided. In addition, value for the
month should be validated such that it will have only values from to If
invalid, set month to Also, values for the day should be validated according
to the month. For example, if month is then day should range from to
You can ignore leap years for now.
Accessors Getters : appropriate accessor methods for each of
the data members. These methods should be const methods.
Mutators Setters : appropriate mutator methods for each of the
data members.
print : method to print the date in the format mmddyy with yy as
four digits.
You must define the specification in a file called Date.h and the implementation
of constructors and the methods should be another file called Date.cpp
Demonstrate that your class is working by doing the following:
creating a Date object called d using the default constructor. Nothing is
supplied.
creating a Date object called d by providing values for month, day and
year.
Call the print method in each object to show that it is working correctly.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
