A subtraction tutor

Concepts used: Random number generation, count-controlled loop, counter variable, string data (very basic), two-way and many-way decision making.

Relevant Labs: This assignment uses techniques seen in these labs: 5 through 9.

• This assignment asks you to design and implement a program that could be used for testing grade school students’ subtraction skills.

The program will operate as follows:
1. It will display the standard sign-on message.
2. The program will greet the student and ask for his/her first name. This name will be read into a string variable and would be used later as part of the report generated.
3. Then the program will present one subtraction problem at a time to the student, using a count controlled loop. The loop will run 10 times, but a named constant should be used to hold that value. The named constant should be used (rather that the literal constant 10) whenever that number is needed for loop control or calculations. The program will generate two random numbers (each number would have 2 digits) and pose the subtraction problem for those numbers like this:
Problem 1: 56 − 25 = ? (Each problem would be sequence numbered).
The program then reads the answer typed by the student and compares it to the answer it calculates and provides one of two possible messages:
Your answer is correct! or,
Your answer is wrong! The correct answer is 31.
Powered by