Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
specialty such as PediatricianObstetricianGeneral Practitioner, etc., so use
type string
Office visit fee use type double
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 hours a month, they
will be paid an extra overtime amount. For one overtime hourthey will be paid: salary
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
hisher 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 Clinicjava You will have three
arrays in this class:
An array for keeping the patients
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:
First create three instances of doctor and two instances of employee. Save them in the
staff array.
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 heshe 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 hisher 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 heshe wants to visit
is hisher 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.
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 objectoriented 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
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