Question
c++ question: Define a class called Month that is an abstract data type for a month. Your class should have a private intager variable that
c++ question:
Define a class called Month that is an abstract data type for a month. Your class should have a private intager variable that represents the month (1 for January, 2 for February, etc.). Include all the following member functions: - A default constructor that set's the month to January. - A constructor to set the month using the first three letters in the name of the month as three arguments. - A constructor to set the month using an integer as an argument. - A mutator function that sets the month by passing in an integer. - An accessor function that returns the value of the month as an integer. - An accessor function that returns the first three letters in the name of the month. - A Member function that returns the next month as a value of type Month. Make sure your class validates user input to verify that a valid month was entered. In main(), test your program by creating 3 different Month objects. The first month object should use an integer value entered by the user as the argment to the constructor. Then, use the Month class member functions to print out the first three letters of the corresponding month and the first three letters of the next month. The second month object should take 3 letters that the user enters as arguments to the constructor. Then, use the Month class member functions to print out the value of that month as an integer, as well as the first three letters of the next month. The third month object should be created using the default constructor. Print out the first three letters of that month and the next month.
This is the sample output:
The gray part is the prompts, and the yellow part is standard output
Enter a month value as an integer:12 This month is DEC. The next month is JAN Enter the first letter of the month name:s Enter the second letter of the month name:E Enter the third letter of the month name:P This is month number 9 The next month is OCT Using the default constructor, the month is JAN The next month is FEBStep 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