1. Input names of students from the user, terminated by ZZZ, and
create a data file GRADES with records of the form:
student (string), test1 (integer), test2 (integer), test3 (integer)
In this file, all test scores should be set equal to 0.
2. Display the contents of the file GRADES created in Problem 1.
Each student’s record should appear on a separate line and include
the total score (the sum of the three tests) for that student. For
example, a line of output might be:
R. Abrams 76 84 82 242

Also, As long as the user does not enter "ZZZ" new records are created and automatically added, and when reading the file all records will be displayed, correct?

If someone could take a look at this and critique, it would be appreciated.

Process
Get Student Name, Test Score
Create New File “Grades”
Calculate Grade Total

Input
Student Name
Test Scores

Output
Read Grade File, “Student”, “Test1", "Test2”, "Test3", “Total”

Main Module
Declare Student as String
Declare Test1, Test2, Test3, as Integer
While Student <> “ZZZ”
Call Student Grades
Call Calculate Grades
Call Display Grades
End While
End Program

Student Grades
Open “Grades” For Output as NewFile
Write “Enter the student and three test scores separated by commas please.”
Write “Enter “ZZZ” when done
Input Student, Test1, Test2, Test3

While Student <> “ZZZ”
Set Test = 0
Write NewFile, Student, Test1, Test2, Test3
Write “Enter the students name and three test scores.”
Write “Enter “ZZZ” when done.”
Input Student, Test1, Test2, Test3
End While
End Student Grades

Calculate Grades
Declare Total as Integer
Set Total = Test1 + Test2 + Test3
Close NewFile
End Calculate Grades

Display File
Open “Grades” For Output as GradeFile
Read GradeFile, “Student”, “Test1”, “Test2”, “Test3”, “Total”
End Display File

I understand the problem differently. Here's my view, not in pseudo-code but just giving the overall logic.

Problem 1:
Get from the user a list of students but no test scores. When the student name is ZZZ, write the student names to a file along with 0,0,0 for test scores.

Problem 2:
Read the file created in problem one, students and test scores. Display the student names along with input boxes for test scores and one text box for the sum. Every time a new test score is entered, recalculate the sum. I don't think, from what I'm reading, that you need to write the test scores back to the file, but that question should be clarified with your fellow students/professor.

All right, let's see your pseudo-code version 2.

Input names of students from the user, terminated by ZZZ, and
create a data file GRADES with records of the form:
student (string), test1 (integer), test2 (integer), test3 (integer)
In this file, all test scores should be set equal to 0.
2. Display the contents of the file GRADES created in Problem 1.
Each student’s record should appear on a separate line and include
the total score (the sum of the three tests) for that student. For
example, a line of output might be:
R. Abrams 76 84 82 242

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.