501 Assignment#4.docx - 501 Homework#4 Shice Li 1(a Start...

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

501 Homework #4 Shice Li 1. (a) Start Declarations inputfile summerfile inputfile summerfile 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 finishup() Stop getready() open summerfile "Summer.txt" open winterfile "Winter.txt" open mergedfile "Merged.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 output summerFirst, summerLast to mergedFile readsummer() else output winterFirst, winterLast to mergedFile readwinter() endif checkEnd() return finishup() close summerFile close winterFile close mergedFile return (B) Start Declarations Inputfile summerFile InputFile winterFile OutputFile mergedFile Num saveID = 0 Num summerID Num summerAge String summerFirst String summerLast String summerClass
Num winterID Num winterAge String winterFirst String winterLast String winterClass

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture