Alberta Einstein teaches a business class at Podunk University. To evaluate
the students in this class, she has given three tests. It is now the end of the
semester and Alberta would like to have a program that inputs each stu-
dent’s test scores and outputs the average score for each student and the
overall class average. (Hint: The outer loop should allow for Ms. Einstein to
input all the students, one by one, and the inner loop should accept the
three exam scores and compute the average for each student.)
This is what I could come up to. Please if somebody can help me if im doing it right or wrong?
Main module
Declare Name As String
Declare Test1, Test2, Test3, Sum As Real
Declare Choice As Integer
Open “GRADES” For Input As GradeFile
Write “Student Grades Display”
Call Input Choice module
If Choice = 1 Then
Call Display Single Student Record module
Else
Call Display All Student Records module
End If
Close GradeFile
End Program
Input Choice module
Repeat
Write “Enter 1 or 2.”
Write “1: Display a single student’s grades”
Write “2: Display all student grades”
Input Choice
Until (Choice = 1) Or (Choice = 2)
Display Single Student Record module
Declare Student As String
Write “Enter the student’s name.”
Input Student
Write “Name Test 1 Test 2 Test3 Total”
While Not EOF(GradeFile)
Read GradeFile, Name, Test1, Test2, Test3
If Student = Name Then
Set Sum = Test1 + Test2 + Test3
Write Name, Test1, Test2, Test3, Sum
End If
End While
Display All Student Records module
Write “Name Test 1 Test 2 Test3 Total”
While Not EOF(GradeFile)
Read GradeFile, Name, Test1, Test2, Test3
Set Sum = Test1 + Test2 + Test3
Write Name, Test1, Test2, Test3, Sum
End While