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

I need the pseudocodes and the flowcharts for chapter 7, question 3, all of a, b

ID: 3836118 • Letter: I

Question

I need the pseudocodes and the flowcharts for chapter 7, question 3, all of a, b, and c. This is the entire question that is word for word out of the 8th Edition Programming Logic and Design Introductory book by Joyce Farrell.

Laramie Park District has files of participants in its summer and winter programs this year. Each file is in participant ID number order and contains additional fields for first name, lase 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 create a list of the first and last names 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's ID number and name are output only once.

c. Modify the program so that if a participant has more than one record, the ID number and name are output only once along with a count of the total number of classes the participant has taken.

Explanation / Answer

a)

Pseudocode:

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

      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)

Pseudocode:

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

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

            output summerId, summerFirst, summerLast to

            mergedFile

            savedId = summerId

      endif

      readSummer()

else

      if winterId <> savedId then

            output winterId, winterFirst, winterLast to

               mergedFile

            savedId = winterId

      endif

      readWinter()

endif

checkEnd()

return

finishUp()

   close summerFile

   close winterFile

   close mergedFile

return

c)

Pseudocode:

start

Declarations

      InputFile summerFile

      InputFile winterFile

      OutputFile mergedFile

      num saveId = 0

      num count = 0

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

note: completed the psuedocode with the given time for all the parts.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote