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:

c++ question: Define a class called Month that is an abstract data

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 FEB

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!