Decision Tool
Write a web page that has a selector for choosing the type of math to be quizzed on (addition, subtraction, or multiplication), and then will generate five random math problems for the user to solve and an input area for each. Add a submit button which, after clicking, will cause a display area to show the user how many they got correct.
- Math problems should consist of 2 whole number, each between 2 and 12 (e.g. "2 - 6 = ").
- As a bonus, add an area after each question that will show "Correct" or "Incorrect" and display the correct answer after the submit button is clicked
The finished page would look something like this
[Multiplication]
5 * 2 = [10] Correct
2 * 9 = [16] Incorrect, the answer is 18
7 * 3 = [21] Correct
8 * 7 = [56] Correct
3 * 3 = [9] Correct
Total correct: 4
Hint: Random number generator code
A random number between 2 and 12 can be generated like this
var num = 2 + Math.floor(Math.random() * 10);
Hint: Possible structure and code for quiz generator
var mathSymbol = ...
for (var i = 1; i < 6; i++) {
var rand1 = ...
var rand2 = ...
var qText = rand1 + " " + mathSymbol + ...
document.getElementById( "q_area_"+i ).innerText = ...
...
}