Write a program to drill elementary school students on addition, subtraction, multiplication or division. 1. The program
Question:
Write a program to drill elementary school students on addition, subtraction, multiplication or division.
1. The program must allow students to:
• select an operation from a menu (see example in sample output below),
• practice 5 randomly generated problems of that type using whole numbers between 0 and 20
(inclusive), and
• keep score of the percentage they get correct.
2. The program must use:
• switch,
• random number generation, and
• loops.
3. The program must use error traps to prevent these issues:
• Subtraction – prevent problems with negative answers,
• Division – prevent problems with fractional answers
• Menu choice – prevent program crash due to an entry other than 1 to 5
Example Output
Please choose an operation to practice:
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Quit
Enter the number of your choice: 4
2 x 8 = 16
Correct.
1 x 5 = 6
Incorrect. 1 x 5 = 5
6 x 4 = 24
Correct.
4 x 3 = 12
Correct.
7 x 8 = 48
Incorrect. 7 x 8 = 56
You got 60% of the problems correct.
Government and Not for Profit Accounting Concepts and Practices
ISBN: 978-1118155974
6th edition
Authors: Michael H. Granof, Saleha B. Khumawala