the Apgar medical groip keeps patient file for each doctorin the office. each re
ID: 640795 • Letter: T
Question
the Apgar medical groip keeps patient file for each doctorin the office. each record contains the patient's first and last name, home address and birth year. the records are sorted in ascending birth year order. two doctors, Dr. Best and Dr. Crushing, have formed a partnership.
A. design a logic that produced a merged list of patients' names in ascending order by birth year.
B. modify the program so that it does not display patients' names, but only produces a count of the number of patinets born each tear.
Explanation / Answer
b) MODIFIED
Pseudocode:
start
perform housekeeping( )
while bothDone = "N"
perform mainLoop( )
endwhile
perform finishUp( )
stop
housekeeping( )
declare variables
open files
private static void insertInOrder (Comparable[ ] item, int m)
{
Comparable save = item[m];
for(; m > 0 && item[m -1].
compareTo (save) > 0; m--)
item[m] = item[m
-
1];
item[m] = save;
endif
endif
return
readJefferson( )
read jeffRec
if eof then
jeffId = 9999
endif
return
readAudubon( )
read audRec
if eof then
audId = 9999
endif
return
mainLoop( )
if jeffId > audId then
write audId, audLast, audFirst, audAddress
perform readAudubon( )
else
write jeffId, jeffLast, jeffFirst, jeffAddress
perform readJefferson( )
endif
finishUp( )
close files
return
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.