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

Program Description In this assignment you will develop a simpli ed version of a

ID: 3766908 • Letter: P

Question

Program Description
In this assignment you will develop a simpli ed version of a patient health record
management system, for which you need to write two Java classes: EMR.java and
StudentHealthServices.java. As always, include comments in your program wherever
appropriate. Also, you don't need to make this program interactive (So no need of
Scanner class), simply hard-code all the patient information into the program. Same
for simulating patient visit.
Please Name your project StudentHealthServices.
After creating your project please add another le to the project called EMR.

1. In the EMR.java Class
(a) Create the following PRIVATE data- elds:
Name (String)
Date-of-birth (String)
Reason for visit (String)
Body-temperature (double)
Heart-rate (double)
Diagnosis (String)
Prescribed medicine (String)
(b) Declare a static variable that keeps count of how many patients objects
have been created.
(c) Create a default no-arg constructor. Also, increment the patient counter
static variable.
(d) Create a constructor that initializes ONLY the name and date-of-birth
data- elds(i.e. takes two arguments). Also, increment the patient counter static
variable.
(e) Create a constructor that initializes ALL data- elds. Also, increment
the patient counter static variable.
(f) Create getters/setters for ALL the above data- elds. Should be 14 in
total.
(g) Create a getter method for the static variables that keeps tracks of how
many patient objects are created.
(h) Implement an instance method called redFlags. This method should
return a boolean value. The method will return true if either the heart rate is
less than 60 or greater than 100 OR if the body-temp is either less than 97.3 or
greater than 99.1 .
(i) Implement a toString method that will build a String of all the data-
elds of the EMR class. YOU CAN NOT PRINT IN THIS METHOD.

2. StudentHealthServices.java
(a) Print the number of created patien records. This is the number of EMR
instances. At this point this should print 0.
(b) Create 5 new patient records, that is, 5 new objects of the EMR class
(described above).
(c) Print the number of patient records after the above step. Use the
appropriate data eld (not a local variable) of the EMR class above.
(d) Simulate a visit to the Student Health services for 3 of the 5 patients.
This involves two steps:
i. Display(Print) the current values for:
patient name
date of birth
ii. Record the summary of todays visit, that is, update the below data elds,
and also display(print) them. you can simply print the EMR objects after
the simulated visit.:
reason for visit.
vitals (body temperature, heart rate)
diagnosis.
prescribed medicine.
(e)Please document/comment your code.

Explanation / Answer


package StudentHealthServices;

public class EMR {
String Name;
String Date_of_birth;
String Reason_For_Visit;
double Body_temperature;
double Heart_rate;
String Diagnosis;
String Prescribed_medicine;
static int numberOfPatients;
String msg;
public EMR (){
numberOfPatients++;
}
public EMR (String Name, String DOB){
this.Name=Name;
this.Date_of_birth=DOB;
numberOfPatients++;
}
public EMR (String Name, String DOB, String Reason,double Temp, double HeartRate,String Diagnosis,String Medicine){
this.Name=Name;
this.Date_of_birth=DOB;
this.Reason_For_Visit=Reason;
this.Body_temperature=Temp;
this.Heart_rate=HeartRate;
this.Diagnosis=Diagnosis;
this.Prescribed_medicine=Medicine;
numberOfPatients++;
}
public void setName(String Name)
{
this.Name=Name;
}
public void setDOB(String DOB)
{
this.Date_of_birth=DOB;
}
public void setReason(String Reason)
{
this.Reason_For_Visit=Reason;
}
public void setTemp(double Temp)
{
this.Body_temperature=Temp;
}
public void setRate(double Rate)
{
this.Heart_rate=Rate;
}
public void setDiagnosis(String Diagnosis)
{
this.Diagnosis=Diagnosis;
}
public void setMedicine(String Medicine)
{
this.Prescribed_medicine=Medicine;
}
public String getName()
{
return this.Name;
}
public String getDOB()
{
return this.Date_of_birth;
}
public String getReason()
{
return this.Reason_For_Visit;
}
public double getTemp()
{
return this.Body_temperature;
}
public double getRate()
{
return this.Heart_rate;
}
public String getDiagnosis()
{
return this.Diagnosis;
}
public String getMedicine()
{
return this.Prescribed_medicine;
}
public int getNumOfPatients()
{
return numberOfPatients;
}
/*Implement an instance method called redFlags. This method should
return a boolean value. The method will return true if either the heart rate is
less than 60 or greater than 100 OR if the body-temp is either less than 97.3 or
greater than 99.1 */
public boolean redFlags()
{
boolean ans=false;
if(this.Heart_rate<60||this.Heart_rate>100 ||this.Body_temperature<97.3||this.Body_temperature>99.1)
{
ans=true;
}
return ans;
}
public String toString()
{
msg=" Name:"+this.Name+" Date of Birth"+this.Date_of_birth+" Reason for visit:"+this.Reason_For_Visit+" Body Temperature:"+
this.Body_temperature+" Heart Rate:"+this.Heart_rate+" Diagnosis:"+this.Diagnosis+" Prescribed Medicine:"+this.Prescribed_medicine;
return msg;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote