Design a class called dateType to implement the date in a program as a set of integers (year, month, day). The class will include the following operations:
Setters and getters for the private instance variables
A constructor which takes default parameters. Make the default date January 1, 1500.
A print function which outputs the date in the format mm-dd-yyyy.
A function to test whether the year is a leap year
A function which returns the number of days in the month.
A function which returns the number days passed in the year.
A function which returns the number of days remaining in the year
A function which determines if the date is valid. For example, a date of 2-29-2015 would be invalid because 2015 is not a leap year and there are only 28 days in February. Or, the date 4-31-2016 would be invalid because there are only 30 days in April.
Develop the class invariant which verifies that a date is valid.Note that the private instance variables can be set independently which could result in an invalid date. Your class must prevent that from happening. Identify the precondition/postcondition contract and document it in the header file. Write a program to test your class and show that it will not accept an invalid date.
Here is the UML diagram for this class:
Turn in your dateType.h, dateType.cpp, and test files. Also turn in one or more screen shots showing the results of your testing.
Once this project is completed, you will demonstrate that you are able to:
Develop a class invariant which takes into account dependencies among the private instance variables
Design member functions which will prevent these dependencies from invalidating the invariant.
Utilize the invariant to identify the precondition/postcondition contract
Develop test cases that evaluate the effectiveness of the precondition/postcondition contract.