Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Apgar Medical group keeps a patient file for each doctor in the office. Each

ID: 3545577 • Letter: T

Question

The Apgar Medical group keeps a patient file for each doctor in the office. Each record contains the patient's first and last name, home address, and birth year. The records are stored in ascending birth year order. Two doctors, Dr. Best and Dr. Cushing, have formed a partnership. Design the logic that produces a merged list of their patients in ascending order by birth year. Pseudocode only.  Here's what I have Read first record from each file.

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

Explanation / Answer

Pseudocode:

Read first record from each file.
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

-------
Edit: >>> "Not sure how to do that mate."

See, that's the thing about pseudocode, it says *what* to do, not *how* to do it.

Pseudocode has NO RULES.

However, a teacher might impose rules on the class and expect the class to follow examples of the pseudocode in the examples.

But we don't have your examples.

Because there are no rules, I can say:
Read first record from each file.

But you could change that to
Read first record from File1.
Read first record from File2.

And in a real program, the file would have to be opened first. It can be implied in pseudocode but if you think you need to be explicit then you could have

Open DrBestFile.dat as File1
Open DrCushingFile.dat as File2

Remember, your teacher expects that you have the resources (textbook, handouts, class lectures) to be able to do this on your own. I gave you a starting point, but you aren't paying me to do this, so you shouldn't expect someone here to do it all for you.

You should try to do your assignments and if you have trouble post your code and explain where you are having the problem.

You said, "Any help would be great!" Did you mean that, or do you define "help" as doing your complete assignment?