Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ Program Sample Out: Consider the following specification for a Date class that models a calendar date in the Common Era. The analysis
Write a C++ Program
Sample Out:
Consider the following specification for a Date class that models a calendar date in the Common Era. The analysis of each operation is given formally and the parameters must be declared in the order specified, but the design of each operation is given informally in English. Specification for Date Class Data Attributes: Type Name Objects month of the date day of the date year of the date int int int The class invariant (i.e., all valid objects must meet this condition) is: . month is 1 to 12 day is to 31 for January, March, May, July, August, October, and December, 1 to 30 for April, June, September, and November; 1 to 28 for February in a non-leap year, and to 29 for February in a leap year is greater than 0 . For those who do not recall the definition of a leap year, it is any year that is divisible by 4 but not by 100, or is divisible by 400. For example, 2016 is a leap year, 1900 is not a leap year, and 2000 is a leap year Operations Default/Explicit-value constructor initialize attributes from passed values Must have default argument values of 1, 1, 2018, for initial month, initial day, and initial year i.e January 1, 2018) there is no other constructor for this class. Precondition: Initial values must meet class invariant above. If they do not, the default values should be stored and an error message should be displayed saying so. Default Objects initial month initial day initial year Type Movement int int Name received received received 2018 . month Returns month of date Analysis Objects Type Movement Name month of date int
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