Question: Java Project: Patient Files Write a Java program using good object-oriented programming principles that will read from three input files and will write information to

Java Project: Patient Files

Write a Java program using good object-oriented programming principles that will read from three input files and will write information to two output files.

The Files:

- The input file names: PatientListW3.txt, NewPatientList.txt, and RemovePatientList.txt and are located in the current directory.

- The output file names: PatientListW4.txt and PatientErrorsW4.txt should point to the "C\SFC\COP2552\Project2" directory.

- The first input file (PatientListW3.txt) contains the system date from the previous week, all the patient id numbers, patient names, date of birth, and year added as a new patient, within a medical practice at the end of a business day.

- Each value is on a separate line (we have not learned delimiters and tokens, yet....).

- The patient ID number and the three values that follow are one group that belongs together. The next patient ID number and the three values that follow are a group and belong together, and so on.

- The file is sorted in ascending order by patient id number.

- The second input file (NewPatientList.txt) is automatically created when a new patient is seen in the medical office.

- The second input file contains the new patient's ID number, patient name, and date of birth.

- The program will add the current year as the year added as a new patient.

- This file is sorted in ascending order by patient id number.

- The third input file (RemovePatientList.txt) is automatically generated when a patient leaves the medical office.

- This file contains the patient id number, patient name, and date of birth.

- This file is sorted in ascending order by patient id number.

- The first output file (PatientListW4.txt) will contain the current system date (MMDDYYY format - not hardcoded) at the top of the file followed by the patient id number, patient name, date of birth, and year added as a new patient.

- The second output file ( PatientErrorsW4.txt) will contain the current system date (MMDDYYYY format - not hardcoded) at the top of the file followed by the patient id number, patient name, and date of birth that is considered an error. This error occurs if:

-- if a patient is to be added to the medical practice, but the patient id number already exists in the current patient file (PatientListW3.txt).

-- if a patient is to be removed from the medical practice, but the patient id number does not exist in the current patient file (PatientListW3.txt).

-- if no errors exist, this file should not be created.

File Layout: Input Files

PatientListW3.txt NewPatientList.txt RemovePatient.txt
Previous date Patient id number Patient name Date of Birth Year Added Patient id number Patient name Date of birth Year Added ... Patient id number Patient name Date of birth Patient id number Patient name Date of birth ... Patient id number Patient name Date of birth Patient id number Patient name

Output Files

PatientListW4.txt PatientErrorsW4.txt
Current System date Patient id number Patient name Date of Birth Year Added Patient id number Patient name Date of birth Year Added ... Current System date Patient id number Patient name Date of birth Patient id number Patient name Date of birth ...

Program Details: The program will update the current list of patients for the ending week. Of course, this would normally be updated using a database (sigh...soon), but in this project, you create a new output file that will contain the complete list of current patients for the following week. The integrity of the previous week's data is left secure. The program should read in, but ignore the previous date in the PatientListW3.txt input file. It is there to keep track of dates but is not needed in the process of this program. The program must place the current system date (MMDDYYYY format - do not hard code this date) as the first line in the PatientListW4.txt output file. In essence, the program will then merge the current patient file with the new patients to be added and removing the patients that are no longer part of the medical practice.

- Name the class 'Patient'

- To be efficient, this program will not use an array or any other data structure. It is not needed nor efficient.

- All input files are in ascending order by patient ID number.

- The program will read in the first patient id number, patient name, date of birth, and year added from the PatientListW3.txt input file. Store the patient id number, name, and date of birth in a string variable and the year added as an integer variable.

- Next, the program should read in the first patient id number, patient name, and date of birth from the NewPatientList.txt input file.

- Next, the program should read in the first patient id number, patient name, date of birth, and year added from the RemovePatient.txt input file.

- If the patient id number from the PatientListW3.txt file matches the patient id number from the RemovePatient.txt file:

-- do not write this patient's information to the PatientListW4.txt output file.

-- read in the next patient's information from the RemovePatient.txt file.

-- read in the next patient's information from the PatientListW3.txt file.

- If the patient id number from the PatientListW3.txt is less than the patient id number from the RemovePatient.txt file:if the patient id number from the NewPatientList.txt file is less than the current patient id number from the PatientListW3.txt file:

-- insert the new patient information into the PatientListW4.txt file.

-- add the current year as the patient's year added

-- read in the next patient information from the NewPatientList.txt file.

- If the patient id number from the PatientListW3.txt file is less than the patient id number from the NewPatientList.txt file:

-- write the current patient information from the PatientListW3.txt file to the patient information in the PatientListW4.txt file.

-- read in the next value in the PatientListW3.txt file.

- If the patient id number from the RemovePatient.txt file does not match any patient id in the PatientListW3.txt file:

-- an error has occurred - write the patient information (id, name, date of birth, year added) to the PatientErrorsW4.txt output file.

- If the patient id number from the NewPatientList.txt matches the patient id number from the PatientListW3.txt file:

-- an error has occurred - write the patient information (id, name, date of birth, year added) to the PatientErrorsW4.txt output file.

-- write the patient's information from the PatientListW3.txt file to the PatientListW4.txt output file.

An example : Input files

PatientListW3.txt NewPatientList.txt RemovePatient.txt
current date 1111 Smith 12231934 2007 2222 Jones 08141977 1999 3333 White 06261996 2015 4444 Goodson 10102001 2019 5555 Williams 09211988 2000 0123 Adams 05291979 3456 Morris 01311955 5555 Andrews 11131994 8182 Ziegler 06242000 3333 White 06261996 7717 Thomas 04301986

the output files would contain the patients in the following order (with all appropriate data):

PatientListW4.txt PatientErrorsW4.txt
current date 0123 Adams 05291979 2021 1111 Smith 12231934 2007 2222 Jones 08141977 1999 3456 Morris 01311955 2021 4444 Goodson 10102001 2019 5555 Williams 09211988 2000 8182 Ziegler 06242000 2021 current date 5555 Williams 09211988 2000 7717 Thomas 04301986

Expectations:

Be sure to use methods throughout. Each method should be short and do one task.

Use a driver method for the order of execution. main() should simply call the driver method.

Comments throughout the program code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!