[solved]-Create Mathtest Class Two Class Variables 1 Question 2 Answer Question Please Create Acces Q39089984
Create the “MathTest” class. It will have two class variables:1) a question and 2) the answer to that question.
Please create an accessor and mutator method for both of thosevariables, without which we would not be able to see or change thequestion or the answer.
There should be a constructor method. We will also have a“ToString” method, which will print the question followed by itsanswer. The constructor method has two parameters to allow the userto enter a question and answer, or if no input/parameters are giventhen a default question and answer should be supplied (see exercise4 for the default question and answer).
The last method of the class, CheckAnswer, should take in astring as a parameter and compare it to the answer. If the inputwas incorrect, it should return false. Otherwise, it should returntrue.
Create an instance of the “MathTest” class in your “main”method. First ask the user if they want to enter a question andanswer.
If they do, then allow them to enter the test question and itsanswer. If they do not, then continue by using the default questionand answer. The default question should be “Find the value of x in4 = x ^ 2” and the default answer should be “2”. Please use theappropriate constructor methods here.
Then, using the “ToString” method, have it print out those classvariables as described above
. Lastly, call the “CheckAnswer” method. You may eitherterminate the program at this point (if the user types “quit”) orallow for an infinite series of trivia games.
Example:
Would you like to use a default question (yes or no)? “no”
Please enter a test question: “What is the value of x in 56 / x= 14?”
Please enter the answer to that question: “4”
Your question was: “What is your favorite color?” and youranswer was: “Blue”
Please enter your answer to the test question: “4”
Congratulations! You were correct. Example using DefaultQuestion and Answer and with an Incorrect Answer:
Would you like to use a default question (yes or no)? “yes”
Please enter a test question: “”
Please enter the answer to that question: “” Your question was:“Find the value of x in 4 = x ^ 2” and your answer was: “2”
Please enter your answer to the test question: “16”
I’m sorry, you were incorrect.
Expert Answer
Answer to Create the “MathTest” class. It will have two class variables: 1) a question and 2) the answer to that question. Ple… . . .
OR

