
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
Edition 7ISBN: 1285225562
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
Edition 7ISBN: 1285225562Laramie 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.
Step 1 of 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
Step 2 of 25
Step 3 of 25
Step 4 of 25
Step 5 of 25
Step 6 of 25
Step 7 of 25
Step 8 of 25
Step 9 of 25
Step 10 of 25
Step 11 of 25
Step 12 of 25
Step 13 of 25
Step 14 of 25
Step 15 of 25
Step 16 of 25
Step 17 of 25
Step 18 of 25
Step 19 of 25
Step 20 of 25
Step 21 of 25
Step 22 of 25
Step 23 of 25
Step 24 of 25
Step 25 of 25
Why don’t you like this exercise?
Other