Week 4.docx - Laramie Park District has files of...

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

Laramie Park District has files of participants in its summer and winter programs this year. Eachfile is in participant ID number order and contains additional fields for first name, last name, age,and class taken (for example, Beginning Swimming).a. Design the logic for a program that merges the files for summer and winter programs to createa list of the first and last names of all participants for the year.Laramie park district has files of participants in its summer and winter programs this year.Pseudocode:startDeclarationsInputFile summerFileInputFile winterFileOutputFile mergedFilenum 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 thenoutput summerFirst, summerLast to mergedFilereadSummer()elseoutput winterFirst, winterLast to mergedFilereadWinter()endifcheckEnd()returnfinishUp()close summerFileclose winterFileclose mergedFilereturn

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 16 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture