expand icon
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

النسخة 7الرقم المعياري الدولي: 1285225562
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

النسخة 7الرقم المعياري الدولي: 1285225562
تمرين 17

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, 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 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.

الحلول خطوة بخطوة
موثّق
like image
like image

الخطوة 1 من25

a.

The following is the required pseudo code for merging the files containing data for summer and winter together.

start

Declaration

InputFile win_Cus

InputFile sum_Cus

Outputfile mergefile

num win_Cus_Id

num id = 0

String win_First_Name

String win_Last_Name

string win_Class

num win_Age

num sum_Cus_Id

String sum_First_Name

String sum_Last_Name

string sum_class

num sum_Age

num end_Num= 9999

String areBothAtEnd= “N”

getReady()

While arebothAtEnd=“Y”

mergeRecord()

Endwhile

finish()

Stop

getReady()

Open win_Cus “win_cus.dat”

Open sum_Cus “sum_cus.dat”

Open mergefile “cus.dat”

readWin()

readSum()

checkEnd()

Return

readWin()

Input win_Cus_Id, win_First_Name, win_Last_Name,

win_Age, win_Class

from win_Cus from win_Cus

If eof then

win_Cus_Id = end_Num

Endif

Return

readSum()

Input sum_Cus_Id, sum_First_Name, sum_Last_Name,

sum_Age, sum_Class from sum_Cus

If eof then

sum_Cus_Id = end_Num

endif

return

checkEnd()

if win_Cus_Id = end_Num and

if sum_Cus_Id= end_Num then

areBothAtEnd=”y”

endif

endif

return

mergeRecord()

if win_Cus_Id < sum_Cus_Id then

output win_Cus_Id, win_First_Name,

win_Cus_Last_Name

to mergefile

readWin()

else

output sum_Cus_Id, sum_First_Name,

sum_Last_Name to

merge file

readSum()

endif

checkEnd()

return

finish()

close win_Cus

close sum_Cus

close mergefile

return


الخطوة 2 من 25


الخطوة 3 من 25


الخطوة 4 من 25


الخطوة 5 من 25


الخطوة 6 من 25


الخطوة 7 من 25


الخطوة 8 من 25


الخطوة 9 من 25


الخطوة 10 من 25


الخطوة 11 من 25


الخطوة 12 من 25


الخطوة 13 من 25


الخطوة 14 من 25


الخطوة 15 من 25


الخطوة 16 من 25


الخطوة 17 من 25


الخطوة 18 من 25


الخطوة 19 من 25


الخطوة 20 من 25


الخطوة 21 من 25


الخطوة 22 من 25


الخطوة 23 من 25


الخطوة 24 من 25


الخطوة 25 من 25

close menu
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
cross icon