Question
The Apgar Medical Group keeps a patient file for each doctor in the office. Each record contains the patients first and last name, home address,
The Apgar Medical Group keeps a patient file for each doctor in the office. Each record contains the patients first and last name, home address, and birth year. the records are sorted in ascending birth year order. Two doctors, Dr. Best and Dr. Cushing, have formed a partnership.
Modify this program so that it does not display patients' names but only produces a count of the number of patients born each year
start
declarations
InputFile bestFile
InputFile cushingFile
OutputFile mergedFile
num bestBirthYr
string bestFirst
string bestLast
string bestAddress
num cushingBirthYr
string cushingFirst
sttring cushingLast
string cushingAddress
string areBothAtEnd= "N"
num END_YEAR = 0
getReady()
while areBothAtEnd <> "Y"
mergedRecords()
endwhile
finishUp()
stop
getReady()
open bestFile "ApgarMedicalBest.txt"
open cushingFile "ApgarMedicalCushing.txt"
open mergedFile "ApgarMEdical.txt"
readBest()
readCushing()
checkEnd()
return
readBest()
input bestFirst, bestLast, bestAddress, bestBirthYr from bestFile
if eof then
bestBirthYr = END_YEAR
endif
return
readCushing()
input CushingFirst, cushingLast, cushingAddress, cushingBirthYr
from cushingFile
if eof then
cushingBirthYr = END_YEAR
endif
return
checkEnd()
if bestBirthYr = END_YEAR then
if cushingBirthYr = END_YEAR then
areBothAtEnd = "Y"
endif
endif
return
mergeRecords()
if bestBirthYr < cushingBirthYr then
output bestFirst, bestLast, bestAddress, bestBirthYr
to mergeFile
readBest ()
else
output cushingFirst, cushingLast, cushingAddress,
cushingBirthYr to mergedFile
readCushing()
endif
checkEnd()
return
finishup()
close bestFile
close cushingFile
close mergedFile
return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started