subject

Hello I am having touble with finishing the code of Designing a class Named Month Design a class named Month. The class should have the following private members: - name A string object that holds the name of a month, such as “January,” “February,” etc. - monthNumber An integer variable that holds the number of the month. For example, January would be 1, February would be 2, etc. Valid values for this variable are 1 through 12. In addition, provide the following member functions: - A default constructor that sets monthNumber to 1 and name to “January.” - A constructor that accepts the name of the month as an argument. It should set name to the value passed as the argument and set monthNumber to the correct value. - A constructor that accepts the number of the month as an argument. It should set monthNumber to the value passed as the argument and set name to the correct month name. - Appropriate set and get functions for the name and monthNumber member variables. - Prefix and postfix overloaded ++ operator functions that increment monthNumber and set name to the name of next month.
I also need to have pre fix ++ and pro fix-- functions need to be doing different things and i need to adding the result of pre and post to another variable to see the true effect of pre and post fix.
This is my code so far please help

#include // header the contains function for input/output
#include > (istream&, Month&);
};
//
//Implementation section of the function created
//
Month ::Month() //default constructor to set the name of the month to January and 1
{
name = "January";
monthNumber = 1;
}

Month::Month(string name) //1 parameter constructor that retrieves the name of the month
{
for (int count = 0; count < 12; count++)
{
if (name == monthNames[count])//if the name of the month and monthname are the same
{
monthNumber = count + 1;//month number will be counter +1 because it is at 0
break;
}
if (count == 11)
{
cout << " Invalid month name.\n" << endl;
}
}
}
Month::Month(int n)//constructor with number of month it is in parameter
{
if (n < 1 || n > 12)
{
cout << "Invalid month number. Please Enter month number 1 through 12" << endl;

}
else
{
monthNumber = n;
name = monthNames[n - 1]; // size of number start from 0 so size-1 will give correct
}
}
//
//Setter Functions(mutator functions) to manipulate the
//data
//
void Month::setName(string nm)
{
for (int count = 0; count < 12; count++)
{
if (nm == monthNames[count])
{
//I would assign the name to monthname because it is a match
nm = monthNames[count];

}
else
{
cout << "Not valid Month Name";
}
}
return;

}
//
//Mutator Function for Month Number to change data
//
void Month::setMonthNumber(int nb)
{
//checking validation of correct input to go throug
if (nb < 1 || nb>12)
cout << "Invalid month number. Please Enter month number 1 through 12";
else
{
monthNumber = nb; //valid so monthnumber input will be assigned to monthNumber variable to be changed
name = monthNames[nb - 1];// valid so monthname in the array will be assiigned mutated to change in name
}//if closed

}//function closed

//
Getter functions to get the data Accessors should always declare const
so it doesnt change the calling obj by accident
//
int Month::getmonthNumber() const //getter function to return number
{
return monthNumber;
}
string Month::getName()const // getter function to return name
{
return name;
}
//
// prefix -- operator check if months are correct and because its an array
// and it starts from 0 as january we make sure once it goes over 11 to 12
// it will go back to month equalling january as 1
Month::operator++()
{
}
int Month::operator--()
{
return;
}

/* void setName(string name)
for ()
{
if (name == = )
{
cout << " error";
}

void setMonthNumner(int num)
{}
prefixt opeator
post fix opeator
void print()
// cin print >> opeater
ifstream <<
void print()
ofstream <<
// cout << opeater
{} */

int main()
{
int mNumber;
string mname;
cout << "Enter Month number between 1-12";
cin >> mNumber;
while(mNumber<12 && mNumber>0)
Month m1; //instantiation M1 is instance of Month Obj
Month m2(int); //m2 is a instance of Month object
Month m3(string); //m3 is a instance of Month object

//create objects for month class
//set and get the month name
//set and get the month number
//out << "Type in a Month :";

system("pause");
return 0;

}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:30
Assignment directions the owner of a popular local coffee shop has approached you to design a network for his business. he would like to offer his customers wifi access to the internet, but also thinks it might be handy to network the kitchen and store room together with the office computer he already uses for ordering, scheduling, and payroll. he thinks that might save him time doing inventory control and ordering. your assignment is to create a set of questions for him that will precisely define the purpose of the network and any constraints and restrictions on its implementation. assignment guidelines create a list of at least ten questions to ask your customer. of those ten questions, at least one question must come from each of the following subject areas: purpose of the network network access and security issue network availability and fault tolerance issues future expansion issues vendor issues briefly explain in two or three sentences why you would ask each question and what you expect to learn from your customer’s response. submission requirements your questions should meet the criteria of a good survey question by being specific, unambiguous, and closed-ended. all questions, as well as your explanations, should be written in proper english using correct grammar, spelling, and punctuation. use complete sentences, and do not use slang, texting abbreviations, or shortcuts.
Answers: 3
question
Computers and Technology, 23.06.2019 20:30
What are some settings you can control when formatting columns?
Answers: 1
question
Computers and Technology, 24.06.2019 12:10
What is it called during the editing process when the processor ensures that a character holding a coffee mug from one angle is holding the same mug in the same way when the shot switches to another camera at another angle? cinematography continuity technology prop use
Answers: 1
question
Computers and Technology, 24.06.2019 13:10
Write a program that has a conversation with the user. the program must ask for both strings and numbers as input. the program must ask for at least 4 different inputs from the user. the program must reuse at least 3 inputs in what it displays on the screen. the program must perform some form of arithmetic operation on the numbers the user inputs. turn in your .py file as well as a screenshot of your program's output. include comments in your code to explain how it works an example program run might look like (have fun with this and be creative): ‘what is your name? ’ “josh” ‘, josh. what is your favorite color? ’ “green” ‘mine too. do you also like ice cream? ’ “no” ‘josh, how old are you? ’ “40” ‘ and how many siblings do you have? ’’ “3” ‘that means you are one of 4 kid(s). is green the favorite color of anyone else in your house? ’
Answers: 3
You know the right answer?
Hello I am having touble with finishing the code of Designing a class Named Month Design a class na...
Questions
question
English, 26.06.2019 03:00
Questions on the website: 13722360