Question: Create a Month class that does the following: keeps track of the current Month and Year as integers. A default constructor that sets the month
Create a Month class that does the following:
- keeps track of the current Month and Year as integers.
- A default constructor that sets the month to January of 1970
- A constructor that sets the month to January of the indicated year.
- A constructor that sets the month and year.
- Check the month, make sure it is between 1 and 12.
- Do anything you want to make it correct if it isn't.
- A toString() function that returns the name of the month and the year. "Janurary, 1970";
- An overloaded pre-fix and post-fix ++ operator that adds one month. Jan -> Feb. Feb->March, etc.
- Move the year and month if DEC
- An overloaded << operator to print the Month to a stream.
- Hint: use the toString() inside it to help out.
- This is a c++ program
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
