# intro to java problem for school

• 10-15-2009, 11:20 PM
thr33
intro to java problem for school
Can someone help me with this problem? The trouble I'm having is with the end with (“Congratulations!” or "Please ask your teacher for help", depending on whether the
student gets more than 7 correct answers or not).

Suppose you are asked to design a software tool that helps an elementary school student learn
arithmetic operations. The software allows the student to select the arithmetic operation she or he
wishes to study. The student chooses from a menu one of two arithmetic operations: 1) addition,
2) subtraction
Based on the student choice, the software tests the user with exactly 10 questions. For each
question, two random positive one-digit integers are generated; then the student is asked to enter
the answer for the arithmetic operation applied to the two numbers.
The software displays a message “Congratulations!” if more that 7 questions are answered
Question 1 (40 points)
a) Write a problem-solving algorithm to execute the arithmetic test for a student for addition
or subtraction operations. The algorithm receives an integer that represents the required
operation from the main algorithm (1 for addition and 0 for subtraction). The algorithm
then gets the student to answer 10 questions as follows:
a. Randomly generates two positive one-digit integers.
b. Ask the student to enter the answer for the arithmetic operation of the two
numbers,
c. Checks if the result is true.
As questions are answered, the correct answers are counted. The number of correct
answers is returned to the calling algorithm.
b) Create a main algorithm to interact with the student to obtain the choice for either
addition or subtraction and produce the results for a student and then calls the algorithm
developed in part (a) to test the student (recall this algorithm returns the number of
correct answers). The main algorithm prints one of two possible messages to the student