Checkpoint Week 7 Chapter 5

Only available on StudyMode
  • Topic: Andrew Martin, Ring, Addition
  • Pages : 3 (334 words )
  • Download(s) : 138
  • Published : October 14, 2011
Open Document
Text Preview
Analysis:

Process:

1. Open “GRADES” file
2. Display StudentName
3. Display TestScores
4. Add TestScores
5. Display Sum

Input:

StudentName As String
Test1 As Integer
Test2 As Integer
Test3 As Integer
Sum As Integer

Output:

Display all three TestScores and the Sum

Problem 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 b e set equal to 0.

Main Module

Declare StudentName As String
Declare Test1, Test2, Test3 as Integers
Open “GRADES”
Call WriteGrades Module
Close “Grades”

End Main Module

WriteGrades Module

Declare StudentName As String
Declare Test1 As Integer
Declare Test2 As Integer
Declare Test3 As Integer
Open “GRADES” For Output As TestScores
Set Test1, Test2, Test3 = 0
Display “Enter student’s name and test scores separated by a comma.”
Display “Enter ZZZ for student’s name when you are finished.”
Display “ To move on to the next student entry hit the enter key.”
Input StudentName, Test1, Test2, Test3

While StudentName <> “ZZZ”
Display TestScores, StudentName, Test1, Test2, Test3
Display “Enter student’s name and test scores separated by a”
Display “comma”
Display “Enter ZZZ when you are finished.”
Input “ZZZ”
End While
Close TestScores

End WriteGrades Module

Problem 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 output might be:

R. Abrams768482242

Main Module

Declare StudentName As String
Declare Test1, Test2, Test3 As Integers
Declare Sum As Integer
Open “GRADES”
Call ComputeSum Module
Call DisplayGrades Module
Close “GRADES”

End Main Module

ComputeSum Module
Sum...
tracking img