Question: Can anyone help me with this C++ problem using a .cpp file with Classes? I am confused. ***It is REQUIRED to use proper headerfiles .h
Can anyone help me with this C++ problem using a .cpp file with Classes? I am confused.
***It is REQUIRED to use proper headerfiles .h and .cpp. Show work for both standard file, the header file, and .cpp file. ***
Make one class called Month containing each of these private members:
1.) One string object to store the title of a given month (i.e. January, March, etc.). - Title this object NAME.
2.) Create a single integer variable that will contain the Month Number with valid numbers of 1-12 only (i.e. January would be 1, February would be 2). - Title this object NUMBMONTH
Also, design the member functions listed below:
1.) A single default constructor to start the object NUMBMONTH as a value of 1 and NAME assigned to January.
2.) One constructor that receives the month name as one argument. You must initialize the name toward the value passed as the argument and set the object NUMBMONTH to the correct value.
3.) Another constructor that receives the number of the month as one argument. It should set the object NUMBMONTH to the value passed as the argument and set name to the correct name of the month.
4.) Make sure that both your overloaded constructors tries to validate all info passed toward the function
5.) Create one copy constructor to receive another month object set to an argument. You need to prepare NAME and NUMBMONTH to each of the values held inside the argument object passed through.
6.) Make a set and get functions in order to properly receive NAME and NUMBMONTH member variables.
***Keep in mind that member variables have to be linked logically. If any change happens to NUMBMONTH. The object must automatically update NAME and vice versa.***
The prefix and postfix ++ operator functions to increment NUMBMONTH and initialize NAME to the name of next month. If NUMBMONTH object is equivalent to a value of 12 when functions perform, they must set NUMBMONTH as 1 and NAME as January.
Include both prefix and postfix overloaded functions to decrement NUMBMONTH and initialize NAME as the name of previous month. If NUMBMONTH is equivalent to a value of 1 when functions perform, they must have NUMBMONTH as 12 and NAME as December.
Set all overloaded cout's << operator and cin's >> operator to opperate with your class named Month.
Your << operator must display objects NAME and NUMBMONTH.
Your >> operator needs to ask for user input for both NAME and NUMBMONTH and then hold it inside the object
Finally, demonstrate the class in a program to ensure that each class function operates accordingly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
