Exercise 6.35-6.37 Algorithm
Essay by review • March 29, 2011 • Essay • 376 Words (2 Pages) • 919 Views
Exercise 6.35-6.37 Algorithm
1. If the user answered the problem correctly or first question
Obtain two random integers.
2. Prompt the user for the product of the two numbers.
If the answer is wrong
Obtain a random integer for the random response.
Display the response corresponding to the random response integer.
[(1) No. Please try again. (2) Wrong. Try once more. (3) Don't give up! (4) No. Keep trying.]
If the answer is right
Obtain a random integer for the random response.
Display the response corresponding to the random response integer.
[(1) Very good! (2) Excellent! (3) Nice work! (4) Keep up the good work!]
If the user types 10 answers, calculate the percent of correct responses.
If the percent is less than 75%, print, "Please ask your instructor for extra help" and end program.
3. Repeat #1-2 while number of answers is less than 15 questions.
---------------------------Output----------------------------
How much is 6 times 4 ? 18
No. Keep trying.
How much is 6 times 4 ? 24
Keep up the good work!
How much is 8 times 10 ? 80
Nice work!
How much is 10 times 0 ? 0
Keep up the good work!
How much is 1 times 5 ? 5
Keep up the good work!
How much is 0 times 5 ? 0
Nice work!
How much is 7 times 10 ? 70
Very good!
How much is 10 times 0 ? 0
Nice work!
How much is 11 times 4 ? 44
Nice work!
How much is 11 times 3 ? 33
Nice work!
How much is 5 times 6 ? 0
Wrong. Try once more.
How much is 5 times 6 ? 2
No.
...
...