It 210 Week 7

It 210 Week 7

1. 2 a. Input names of students from the user, terminated by ”ZZZ”,0,0,0, and create a data file grades with records of the following form: student (String), test1 (Integer), test2 (Integer), test3 (Integer) Analysis Processes 1. Display Input student name and test scores screen 2. Prompt for Student name 3. Prompt scores 4. Perform calculations 5. Provide student names, scores and total Input 1. Student Name 2. Test Scores Output 1. Display Student name, scores and total 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 Write “Enter students name and test scores. ” Write “Enter ZZZ for students name when finished. ” Input StudentName, Test1, Test2, Test3 While StudentName “ZZZ” Write TestScores, StudentName, Test1, Test2, Test3 Write “Enter students name and test scores. ” Write “Enter ZZZ for students name when finished. ” Input StudentName, Test1, Test2, Test3 End While Close TestScores 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 as follows: R. Abrams 76 84 82 242 Declare Sum as integer Open “GRADES” For Input As TestScores While Not (TestScores) Read TestScores, StudentName, Test1, Test2, Test3 Add Test1 + Test2 + Test3 = Sum Write StudentName, “ “, Test1, Test2, Test3, Sum End While Close TestScores Declare Sum as integer Open “GRADES” For Input As TestScores While Not (TestScores) Read TestScores, Abrams, 76, 84,82, Add 76 + 84 + 82 = 242 Write “Abrams 84, 82, 76, 242” End While Close TestScores Expected Output: Abrams 76 84 82 242