Math Quiz Maker
Write a program that will prompt the user for a type of math to be quizzed on (addition, subtraction, or multiplication), and then will generate random math problems for the user to solve until a mistake is made, after which it will show the user how many they got correct. A run through the finished program should look something like this:
What kind of math will you practice? 1 = addition, 2 = subtraction, 3 = multiplication
3
5 * 2 = 10
Correct
2 * 9 = 17
Incorrect, the answer is 18
Total correct: 1
Requirements
- Prompt for a number to specify the type of math problems to make (1 = addition, 2 = subtraction, 3 = multiplication).
- Here, if the user inputs a number other than 1, 2, or 3, display "Not an option" and end the program.
- Math problems should consist of 2 whole number, each between 2 and 12 (e.g. "2 - 6 = ").
- Let the user's answer appear on the same line as the question.
- After the user inputs an answer, it should say "Correct", or "Incorrect" and display the correct answer.
- Put a blank line between the original prompt, each problem, and the end score display.
- Set a limit to 50 questions (as a precaution against getting stuck in an infinite loop).
Hints
Hint: Random number generator code
A random number between 2 and 12 can be generated like this
int num = 2 + (int)(Math.random() * 10);
Hint: Possible structure and code for quiz cycle
boolean correct = false;
for (int i = 0; i < 50 && correct; i++) {
// Generate and display a question
// Receive user input
// For incorrect answer, set correct = false
}