Question: We need a program that can be used by elementary school students to practice and improve their basic arithmetic skills in addition, subtraction, and multiplication.
We need a program that can be used by elementary school students to practice and improve their basic arithmetic skills in addition, subtraction, and multiplication. The purpose of the program is to display a randomly generated arithmetic problem and ask the student to enter the answer. The program should check the students answer and output an appropriate message. Each time the program is run, a different problem should be displayed. The program will implement the following algorithm. 1. Generate two random numbers in the range 1-20 inclusive and save them in variables num1 and num2. 2. Make sure num1 is greater than num2. If num1 is less than num2, then initialize num1 to 20. 3. Display a problem for addition, subtraction, or multiplication as follows: generate a random number r between 0 and 2 inclusive. If r is equal to 0, display the problem num1 + num2 = Then, compute the correct answer and save it in a variable called correctAnswer. If r is equal to 1, display the subtraction problem num1 num2 = and compute the correct answer. If r is equal to 2, repeat the same for multiplication. 4. Input the studentAnswer. If the studentAnswer is equal to the correctAnswer, display an encouraging message; otherwise, display another message and show the student the correctAnswer.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
