C modify the library program so that if a participant

This preview shows page 7 - 11 out of 16 pages.

c) Modify the library program so that if a participant has more than one record, you output the name only once, but you also output a count of the total number of classes the participant has taken.Pseudocode:startDeclarationsInputFile summerFileInputFile winterFileOutputFile mergedFilenum saveId = 0num count = 0num summerIdnum summerAgestring summerFirststring summerLaststring summerClassnum winterIdnum winterAgestring winterFirststring winterLaststring winterClassstring areBothAtEnd= “N”num END_ID = 999999getReady()while areBothAtEnd <> “Y”mergeRecords()
endwhilestopgetReady()open summerFile “LaramieParkDistrictSummer.txt”open winterFile “LaramieParkDistrictWinter.txt”open mergedFile “LaramieParkDistrict.txt”readSummer()readWinter()checkEnd()returnreadSummer()input summerId, summerFirst, summerLast, summerAge,summerClass from summerFileif eof thensummerId = END_IDendifreturnreadWinter()input winterId, winterFirst, winterLast, winterAge,winterClass from winterFileif eof thenwinterId = END_IDendifreturncheckEnd()
if summerId = END_ID AND winterId = END_ID thenareBothAtEnd= “Y”endifreturnmergeRecords()if summerId < winterId thenif summerId <> savedId thenif count > 1 thencontrolBreak()endifoutput summerID, summerFirst, summerLast tomergedFilesavedId = summerIdendifreadSummer()elseif winterId <> savedId thenif count > 1 thencontrolBreak()endifoutput winterID, winterFirst, winterLast tomergedFilesavedId = winterIdendifreadWinter()
endifcount = count + 1checkEnd()returncontrolBreak()output “Count for ”, savedId, “ = ”, count to mergedFilecount = 0returnfinishUp()if count > 1 thencontrolBreak()endifclose summerFileclose winterFileclose mergedFilereturn

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture