Exercise 15: Multiplication
Date completed: 14/06/2018
Computers are playing an increasing role in education. Write a program that will help an elementary-school student learn multiplication. Use Math.random to produce two positive one-digit integers. It should then display a question such as:
How much is 6 times 7?
The student then types the answer into a text field. Your program checks the student‘s answer. If it‘s correct, display the string “Very good!” and generate a new question. If the answer is wrong, display the string “No. Please try again.” and let the student try the same question again repeatedly until he or she finally gets it right. A separate function should be used to generate each new question. This function should be called once when the script begins execution and each time the user answers the question correctly.