Module main() //Declare local variables Declare Integer counter = 0 Declare String studentName = “NO NAME” Declare Real averageRight = 0.0 Declare Real right = 0.0 Declare Integer number1 = 0 Declare Integer number2 = 0 Declare answer = 0.0 Set studentName = inputNames() //Loop to run program again While counter < 10 //calls functions Call getNumbers(number1, number2) Set answer = getAnswer(number1, number2, answer) Set right = checkAnswer(number1, number2, answer, right) Set counter = counter + 1 End While Set averageRight = results(right, averageRight) Call displayInfo(right, averageRight, studentName) End Module Function String inputNames(String studentName) Display Student “Enter Name:” Input studentName Return studentName End Function Module getNumber(Integer Ref number1, Integer Ref number2) Set number1 = random(1, 500) Set number2 = random(1, 500) End Module Function Integer getAnswer(Integer number1, Integer number2, Integer answer) Display is the answer to the following “What equation” Display number1 Display “+” Display number2 Display is the “What sum:” Input answer Return answer End Function
Module main() //Declare local variables Declare Integer counter = 0 Declare String studentName = “NO NAME” Declare Real averageRight = 0.0 Declare Real right = 0.0 Declare Integer number1 = 0 Declare Integer number2 = 0 Declare answer = 0.0 Set studentName = inputNames() //Loop to run program again While counter < 10 //calls functions Call getNumbers(number1, number2) Set answer = getAnswer(number1, number2, answer) Set right = checkAnswer(number1, number2, answer, right) Set counter = counter + 1 End While Set averageRight = results(right, averageRight) Call displayInfo(right, averageRight, studentName) End Module Function String inputNames(String studentName) Display “Enter Student Name:” Input studentName Return studentName End Function Module getNumber(Integer Ref number1, Integer Ref number2) Set number1 = random(1, 500) Set number2 = random(1, 500) End Module Function Integer getAnswer(Integer number1, Integer number2, Integer answer) Display “What is the answer to the following equation” Display number1 Display “+” Display number2 Display “What is the sum:” Input answer Return answer End Function