Chapter 5 Programming Problems

Chapter 5 - Input Student Test3 While Student<> “0” Write NewFile Student Test3 Write “Enter student’s name and test score.” Write

This preview shows pages 1–2. Sign up to view the full content.

Chapter 5 Programming Problems 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). Main Module Declare Student As String Declare Test1, Test2, Test3 As Integer Call Input Module End Program Input Module Open “Grades” For Output As NewFile Write “Enter the student’s name and test score.” Write “Enter ZZZ for both when done.” Input Student, Test1 While Student <> “0” Write NewFile, Student, Test1 Write “Enter student’s name and test score.” Write “Enter ZZZ for both when done.” Input Student Test2 While Student <> “0” Write NewFile, Student, Test2 Write “Enter student’s name and test score.” Write “Enter ZZZ for both when done.”

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Input Student Test3 While Student <> “0” Write NewFile, Student, Test3 Write “Enter student’s name and test score.” Write “Enter ZZZ for both when done.” Input Student Score End While Close NewFile 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 Declare Sum As Real Set Sum = Test1 + Test2 + Test3 Open “Grades” For Input As GradeFile While Not EOF(GradeFile) Read GradeFile, Name, Test1, Test2, Test3 Write Name, “ “, Test1, Test2, Test3, Sum End While Close GradeFile...
View Full Document

This note was uploaded on 07/05/2011 for the course IT 210 taught by Professor Josephpillera during the Spring '10 term at University of Phoenix.

Page1 / 2

Chapter 5 - Input Student Test3 While Student<> “0” Write NewFile Student Test3 Write “Enter student’s name and test score.” Write

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online