Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Laramie park District has files of particpants in its summer and winter program

ID: 3688576 • Letter: L

Question

Laramie park District has files of particpants in its summer and winter program this year. each file is in participant ID number order and contains additional fields for first name, last name age, and class taken ( for example, Begining Swimming).

a. Design the logic for a program that merges the file for summer and winter programs to create a list of all participants for the year in ID number order.

b. Modify the program so that if a participant has more than one record, the participant ID number and name are output only once.

c. Modify the program so that if participant has more than one record, ID number of classes the participant has taken.

Explanation / Answer

Can help you with this code:

start
Declarations
InputFile summerFile
InputFile winterFile
OutputFile mergedFile
num summerId
num summerAge
string summerFirst
string summerLast
string summerClass
num winterId
num winterAge
string winterFirst
string winterLast
string winterClass
string areBothAtEnd= “N”
num END_ID = 999999
getReady()
while areBothAtEnd <> “Y”
mergeRecords()
endwhile
stop
getReady()
open summerFile “LaramieParkDistrictSummer.txt”
open winterFile “LaramieParkDistrictWinter.txt”
open mergedFile “LaramieParkDistrict.txt”
readSummer()
readWinter()
checkEnd()
return readSummer()
input summerId, summerFirst, summerLast, summerAge, summerClass from summerFile
if eof then summerId = END_ID
endif
return readWinter()
input winterId, winterFirst, winterLast, winterAge, winterClass from winterFile
if eof then
winterId = END_ID
endif
return
checkEnd()
if summerId = END_ID AND winterId = END_ID then
areBothAtEnd= “Y” endif
return
mergeRecords()
if summerId < winterId then
if summerId <> savedId then
if count > 1 then
controlBreak()
endif
output summerID, summerFirst, summerLast to
mergedFile
savedId = summerId
endif
readSummer()
else
if winterId <> savedId then
if count > 1 then
controlBreak()
endif output winterID, winterFirst, winterLast to
mergedFile
savedId = winterId
endif
readWinter()
endif
count = count + 1
checkEnd()
return
controlBreak()
output “Count for ”, savedId, “ = ”, count to mergedFile count = 0
return
finishUp()
if count > 1 then
controlBreak()
endif
close summerFile
close winterFile
close mergedFile
return