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 simplified version of

ID: 3694277 • Letter: P

Question

Program Description

In this assignment you will develop a simplified 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.

1. In the EMR.java Class

This class SHOULD NOT have a main method

(a) (14 points) Create the following PRIVATE data-fields:

• Name (String) • Date-of-birth (String)

• Reason for visit (String)

• Body-temperature (double)

• Heart-rate (double)

• Diagnosis (String)

• Prescribed medicine (String)

(b) (5 points) Declare a static variable that keeps count of how many patients objects have been created.

(c) (5 points) Create a default no-arg constructor. Also, increment the patient counter static variable.

(d) (5 points) Create a constructor that initializes ONLY the name and date-of-birth data-fields(i.e. takes two arguments). Also, increment the patient counter static variable.

(e) (8 points) Create a constructor that initializes ALL data-fields. Also, increment the patient counter static variable.

(f) (14 points) Create getters/setters for ALL the above data-fields. Should be 14 in total.

(g) (3 points) Create a getter method for the static variables that keeps track of how many patient objects are created.

(h) (5 points) 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) (5 points) Implement a toString method that will build a String of all the data- fields of the EMR class. YOU CAN NOT PRINT IN THIS METHOD.

2. StudentHealthServices.java

All this code should be in the main method of the StudentHealthServices class.

(a) (3 points) Print the number of created patien records. This is the number of EMR instances. At this point this should print 0. Remember which variable in the EMR class keeps track of how many objects of the EMR class has been created.

(b) (5 points) Create 5 new patient records, that is, 5 new objects of the EMR class (described above).

(c) (3 points) Print the number of patient records after the above step. This should print the value 5. Remember which variable in the EMR class keeps track of how many objects of the EMR class has been created.

(d) (10 points) 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 fields, 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) (10 Points) Please document/comment your code

4. Sample Output :

Number of Patients: 0

Number of Patients: 5

****Patient 1 ****

Name : Laura DOB :

1/1/1960 Body Temp : 99.500000

Heart Rate : 77.000000

Reason For Visit : Headaches

Diagnosis : Bad Diet

Prescribed Medicine : Exercise and Better Diet

****Patient 2 ****

Name : Lawrence

DOB : 2/5/1981

Body Temp : 98.500000

Heart Rate : 66.000000

Reason For Visit : Pain in Foot

Diagnosis : Bruised Heel

Prescribed Medicine : Light Walking for 3 weeks.

****Patient 3 ****

Name : Rick

DOB : 12/22/1940

Body Temp : 101.100000

Heart Rate : 88.000000

Reason For Visit : Dizziness and Fatigue

Diagnosis : Fever

Prescribed Medicine : Rest

Explanation / Answer

EMR.Java (due to space some of lines entered into next line check them properly)

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package studenthealthservices;

/**
*
* @author Shivakumar
*/
public class EMR {
private String name; // private data fields
private String dob;
private String reason;
private double bTemp;
private double hRate;
private String diagnosis;
private String pMedicine;
  
public static int pCounter=0; // initializing static variable for keep tranking number of patients
  
public EMR() // defaults no argument constructor
{
pCounter++;
}
public EMR(String name,String dob) // constructor with only 2 files name and dob
{
this.name=name;
this.dob=dob; // setting / initializing private fileds
pCounter++; //incrementing counter
}

// constructor with initializing all fields
public EMR(String name,String dob,String reason,double bTemp,double hRate,String diagnosis,String pMedicine)

{
this.name=name;
this.dob=dob;
this.bTemp=bTemp;
this.hRate=hRate;
this.reason=reason;
this.diagnosis=diagnosis;
this.pMedicine=pMedicine;
pCounter++;
}
public void nameSetter(String name) // setter methods for all fields
{
this.name=name; // setting the field this indicates current class object
}
public void dobSetter(String dob)
{
this.dob=dob;
}
public void reasonSetter(String reason)
{
this.reason=reason;
}
public void bTempSetter(double bTemp)
{
this.bTemp=bTemp;
}
public void hRateSetter(double hRate)
{
this.hRate=hRate;
}
public void pMedicineSetter(String pMedicine)
{
this.pMedicine=pMedicine;
}
public void diagnosisSetter(String diagnosis)
{
this.diagnosis=diagnosis;
}
  
public String nameGetter() // getter methods for getting all data fields
{
return name;
}
public String dobGetter()
{
return dob;
}
public String reasonGetter()
{
return reason;
}
public String pMedicineGetter()
{
return pMedicine;
}
public String diagnosisGetter()
{
return diagnosis;
}
public double bTempGetter()
{
return bTemp;
}
public double hRateGetter()
{
return hRate;
}
  
public static int pCounterGetter()
{
return pCounter;
}
  
public boolean redFlags()
{
if((hRate<60 || hRate>100) || (bTemp<97.3 || bTemp>99.1))
{
return true;
}
else
return false;
}
@Override
public String toString() // overriding to String mehod in object class ( check return one line)
{
return "Name: "+name+" DOB: "+dob+" Body Temp:"+bTemp+" Heart Rate:"+hRate+" Reason to visit:"+reason+" Diagnosis:"+diagnosis+" prescribed Medicine:"+pMedicine;
}
  
}

StudentsHealthServices.java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package studenthealthservices;

/**
*
* @author Shivakumar
*/
public class StudentHealthServices { // class that implement above class and has main method

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Number of Patients: "+EMR.pCounter); // printing starting counter value i.e 0

// creating objects with all arguments constructor
EMR patient1=new EMR("Laura","1/1/1960","Headaches",99.5,77.0,"Bad Diet","Exercise and Better Diet");
EMR patient2=new EMR("Lawrence","2/5/1981","Pain in Foot",98.5,66.0,"Bruised Heel","Light walking for 3 weeks"); //(Check here)
EMR patient3=new EMR("Rick","12/22/1940","Dizziness and Fatigue",101.1,88.0,"Fever","Rest");
EMR patient4=new EMR("Smith","1/21/1981","Hand Pain",99.7,85.0,"injuiry","Rest");
EMR patient5=new EMR("Adele","25/01/1992","Lazziness",99.5,77.0,"Lack of exercise","Exercise and Better Diet"); //(Check here)
System.out.println("Number of Patients: "+EMR.pCounterGetter()); //printing number of patients after objects, 5
System.out.println(" ****Patient 1****");
System.out.println("Name: "+patient1.nameGetter()); // calling nameGetter to print name by calling it
System.out.println("DOB: "+patient1.dobGetter());
patient1.reasonSetter("Headaches again"); // setting the reaming fields i.e updating todays visit
patient1.bTempSetter(98.02);
patient1.hRateSetter(76.3);
patient1.diagnosisSetter("Lazyness");
patient1.pMedicineSetter("Work again perfectly");
System.out.println("Body Temp:"+patient1.bTempGetter());
System.out.println("Heart Rate:"+patient1.hRateGetter());
System.out.println("Reason for Visit:"+patient1.reasonGetter());
System.out.println("Diagnosis:"+patient1.diagnosisGetter());
System.out.println("Prescibed Medicine:"+patient1.pMedicineGetter());
  
System.out.println(" ****Patient 2****");
System.out.println("Name: "+patient2.nameGetter());
System.out.println("DOB: "+patient2.dobGetter());
patient2.reasonSetter("pain in foot again");
patient2.bTempSetter(98.02);
patient2.hRateSetter(76.3);
patient2.diagnosisSetter("Bruised Heel");
patient2.pMedicineSetter("Light running for 5 days");
System.out.println("Body Temp:"+patient2.bTempGetter());
System.out.println("Heart Rate:"+patient2.hRateGetter());
System.out.println("Reason for Visit:"+patient2.reasonGetter());
System.out.println("Diagnosis:"+patient2.diagnosisGetter());
System.out.println("Prescibed Medicine:"+patient2.pMedicineGetter());
  
System.out.println(" ****Patient 3****");
System.out.println("Name: "+patient3.nameGetter());
System.out.println("DOB: "+patient3.dobGetter());
patient3.reasonSetter("vomthings");
patient3.bTempSetter(94.02);
patient3.hRateSetter(78.3);
patient3.diagnosisSetter("Bad Food");
patient3.pMedicineSetter("Take healthy food");
System.out.println("Body Temp:"+patient3.bTempGetter());
System.out.println("Heart Rate:"+patient3.hRateGetter());
System.out.println("Reason for Visit:"+patient3.reasonGetter());
System.out.println("Diagnosis:"+patient3.diagnosisGetter());
System.out.println("Prescibed Medicine:"+patient3.pMedicineGetter());
  
System.out.println(" Now we will use toString method print data of remaining patients(Extra work) ");
  
System.out.println(patient4.toString()); // calling to string method to print patient 4's data
System.out.println("");
System.out.println(patient5.toString()); // calling toSting mehod to print patient5's data
  
}
  
}

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