The Apgar Medical group keeps a patient file for each doctor in the office. Each
ID: 666299 • Letter: T
Question
The Apgar Medical group keeps a patient file for each doctor in the office. Eachrecord contains the patient ’ s first and last name, home address, and birth year. Therecords are sorted in ascending birth year order. Two doctors, Dr. Best and Dr.Cushing, have formed a partnership.
a. Design the logic that produces a merged list of patients ’ names in ascendingorder by birth year.
b. Modify the program so that it does not display patients ’ names, but only produces a count of the number of patients born each year.
Explanation / Answer
a) psuedo code
Read first record from each file(file1 and file2).
Do while data exists in either file.
--- Do while file1.birthyear < file2.birthyear
--- --- copy file1.record to file3
--- --- read next record from file1
--- End Do
--- Do while file2.birthyear < file1.birthyear
--- --- copy file2.record to file3
--- --- read next record from file2
--- End Do
End Do
b)
after the first program is executed you can basically read both the files 1 and 2 for this .
Do while data exist in both the files
-- if year is equal to file1 year or file 2 year
--increment the value of count.
End Do
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.