Chapter 5 Programming Problems

Submitted by: Submitted by

Views: 1857

Words: 400

Pages: 2

Category: Science and Technology

Date Submitted: 08/21/2010 01:52 PM

Report This Essay

The first pseudocode is an example of what it should look like before plugging in the students name and test scores. Then I used J. Smith as an example and plugged in the necessary information.

For each of the following problems, use the top-down modular approach and pseudocode to design a suitable program to solve it.

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.

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 separated by commas.”

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 separated by commas.”

Write “Enter ZZZ for students name when finished.”

Input StudentName, Test1, Test2, Test3

End While

Close TestScores

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 separated by commas.”

Write “Enter ZZZ for students name when finished.”

Input J. Smith, 90, 95, 100

While StudentName “ZZZ”

Write TestScores, J. Smith, 90, 95, 100

Write “Enter students name and test scores separated by commas.”

Write “Enter ZZZ for students name when finished.”

Input ZZZ,

End While

Close TestScores

2. Display the contents of the file GRADES created in Problem 1....