Question: In this project you will write a java program for a clinic. There are three types of people in this system; employee, doctor, and patient.

In this project you will write a java program for a clinic. There are three types of people in this
system; employee, doctor, and patient. These people have some common characteristics,
including: First name, last name, and address.
Doctor has some other characteristics including:
1. specialty (such as Pediatrician,Obstetrician,General Practitioner, etc., so use
type string).
2. Office visit fee (use type double).
3. Number of visited patients
At the end of the month the doctors paycheck is calculated by multiplication of the number of
visited patients by the office fee. The doctor class should have a functionality that adds patients
to the number of visited patients for each visit.
Employee has a variable that keeps their monthly working hours. Their income is a fixed monthly
salary that is saved in their records. However, if they work more than 165 hours a month, they
will be paid an extra overtime amount. For one overtime hourthey will be paid: (salary /165)*1.5
Patient: A Patient record has the name of the patients Primary Care Physician (PCP) and the
name of the last visited doctor (These two fields can have the same value if the patient visited
his/her PCP).
Patient class should have a method name visit() that sets the value of the lastVisitedDoctor
variable.
Write a test program that creates at least two doctors, and at least two employee records, but
the patients will be created by the user. Name your test class as Clinic.java. You will have three
arrays in this class:
1. An array for keeping the patients
2. An array for saving the staff (doctors and employees) to calculate their paycheck.
The test class (a class with the main method) will have three steps:
1. First create three instances of doctor and two instances of employee. Save them in the
staff array.
2. Prompt the user to enter a patient that wants to visit a doctor. Your program should check
if the patient is a new patient, or he/she has a record in our clinic. For the new patients
you should create a patient object (you should prompt the user to enter the patients
information) and save the newly created patient in the patients array. For a patient that
has a record, find his/her record (Find the index of the record in the patients array) to
arrange the visit.
Then call the visit method of the patient and check if the doctor that he/she wants to visit
is his/her primary care doctor. If they want to visit their PCP, just call the visit method of
the doctor to increment the number of visited patients. But if the patient wants to visit a
different doctor, they should visit their primary care doctor as well. So, in this case, you
should call the visit method of both doctors (patients PCP and the specialist that they
want to visit).
Entering patients by the user will be a repetitive task. So, after each patient entry, ask the
user if they want to continue.
3. Print the information and the paycheck of the staff (including doctors and employees).
Doctor, Patient, Employee and Clinic are some of the classes that you need to create, but these
are not enough for a class hierarchy in an object-oriented solution. So, you should decide what
other classes are needed to create a good inheritance and polymorphism.
Make sure your classes have a reasonable complement of constructors, accessor, and mutator
member functions
To get full credit you need to have some class derivation, and the derivation needs to make sense.
Assumption: Assume that the last names are unique. So, when you want to search for a patient
or doctor is the array, you should search with their last name.

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!