Week 7_Homework_Draft2 - Chapter 11 Answers to Exercises 1....

This preview shows page 1 - 12 out of 45 pages.

The preview shows page 11 - 12 out of 45 pages.
Chapter 11Answers to Exercises1. The Springwater Township School District has two high schools—Jefferson andAudubon. Each school maintains a student file with fields containing student ID, lastname, first name, and address. Each file is in student ID number order. Write theflowchart or pseudocode for the program that merges the two files into one filecontaining a list of all students in the district, maintaining student ID number order.
if jeffId > audId thenwrite audId, audLast, audFirst, audAddressperform readAudubon( )elsewrite jeffId, jeffLast, jeffFirst, jeffAddressperform readJefferson( )endifif jeffId = 9999 thenif audId = 9999 thenbothDone = "Y"endifendifreturnfinishUp( )close filesreturn
Flow chart:
2. The Redgranite Library keeps a file of all books borrowed every month. Each file is inLibrary of Congress number order and contains additional fields for author and title.a. Write the flowchart or pseudocode for the program that merges the files for January andFebruary to create a list of all books borrowed in the two-month period.
perform readFeb( )endifif janId = 9999 thenif febId = 9999 thenbothDone = "Y"endifendifreturnfinishUp( )close filesreturn
Flow chart:
b. Modify the program from Exercise 2a so that if there is more than one record for abook number, you print the book information only once.
elseif febId not = saveId thenwrite febId, febTitle, febAuthorsaveId = febIdperform readFeb( )endifendifif janId = 9999 thenif febId = 9999 thenbothDone = "Y"endifendifreturnfinishUp( )close filesreturn
Flow chart:

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 45 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
Frank
Tags
open files, close files

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture