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

Write a JAVA Program for below.(Computerization of Health Records) A health care

ID: 3742904 • Letter: W

Question

Write a JAVA Program for below.(Computerization of Health Records) A health care issue that has been in the news lately is the computerization of health records. This possibility is being approached cautiously because of sensitive privacy and security concerns, among others. Computerizing health records could make it easier for patients to share their health profiles and histories among their various health care professionals. This could improve the quality of health care, help avoid drug conflicts and erroneous drug prescriptions, reduce costs and in emergencies, could save lives. In this exercise, you’ll design a “starter” HealthProfile class for a person. The class attributes should include person’s first name, last name, gender, date of birth (consisting of separate attributes for the month, day and year of birth) , height(in inches) and weight( in pounds). Your class should have a constructor that receives this data. For each attribute, provide set and get methods. The class also should include methods that calculates and returns the user’s age in years, maximum heart rate and target-heart-rate range(see Exercise 1), and body mass index(BMI ; see Ex-2.33-p-73). Write a java application that prompts for the person’s information, instantiates an object of class HealthProfile for that person and prints the information from that object- including the person’s first name, last name, gender, date of birth, height and weight- then calculates and prints the person’s age in years, BMI, maximum heart rate and target-heart-rate range. It should also display the “BMI” values” Also, the application should display the following information from the Department of Health and Human Services/National Institutes of Health so the user can evaluate his/her BMI:

BMI VALUES
Underweight: less than 18.5
Normal:      between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese:       30 or greater

The formulas for calculating BMI are

BMI = weight in Pounds * 703/ heightInInches * heightInInches

Explanation / Answer

HealthProfile.java

import java.util.Calendar;

public class HealthProfile {
   //Declaring instance variables
private String first_name;
private String last_name;
private char gender ;
private int month;
private int day;
private int year;
private int height;
private int weight;

//Parameterized constructor
public HealthProfile(String first_name, String last_name, char gender,
       int month, int day, int year, int height, int weight) {
   super();
   this.first_name = first_name;
   this.last_name = last_name;
   this.gender = gender;
   this.month = month;
   this.day = day;
   this.year = year;
   this.height = height;
   this.weight = weight;
}

//Getters and setters
public String getFirst_anme() {
   return first_name;
}
public void setFirst_anme(String first_name) {
   this.first_name = first_name;
}
public String getLast_name() {
   return last_name;
}
public void setLast_name(String last_name) {
   this.last_name = last_name;
}
public char getGender() {
   return gender;
}
public void setGender(char gender) {
   this.gender = gender;
}
public int getMonth() {
   return month;
}
public void setMonth(int month) {
   this.month = month;
}
public int getDay() {
   return day;
}
public void setDay(int day) {
   this.day = day;
}
public int getYear() {
   return year;
}
public void setYear(int year) {
   this.year = year;
}
public int getHeight() {
   return height;
}
public void setHeight(int height) {
   this.height = height;
}
public int getWeight() {
   return weight;
}
public void setWeight(int weight) {
   this.weight = weight;
}

//This method will calculate the age of the person
public int calAge()
{
   int age = 0;
   Calendar now = Calendar.getInstance(); // Gets the current date and time
  
   int year=now.get(Calendar.YEAR);
   int month=now.get(Calendar.MONTH);
   int day=now.get(Calendar.DAY_OF_MONTH);
  
   if(year>getYear())
   age=year-getYear();
  
   return age;

}

//Thsi method will calculate the maximum heart rate of the person
public int max_heartRate()
{
   return 220-calAge();
}

//Ths method will calculate the target heart rate of the person
public double target_heartRate()
{
   return max_heartRate()*0.85+max_heartRate()*0.5;
}

/* This method will calculate the BMI value
* and display the message based on it
*/
public void calBMI()
{
   double bmi=(getWeight()*703)/getHeight()*getHeight();
   if(bmi<18.5)
       System.out.println("You are UnderWeight");
   else if(bmi>=18.5 && bmi<=24.9)
       System.out.println("You are Normal");
   else if(bmi>=25 && bmi<=29.9)
       System.out.println("You areOverWeight");
   else if(bmi>=30)
       System.out.println("You are Obese");
}

}

_________________________

TestClass.java

import java.text.DecimalFormat;
import java.util.Scanner;

public class TestClass {


   public static void main(String[] args) {
       //Declaring variables
       String fname,lname;
       char gender ;
       int month,day,year,height,weight;
         
       //DecimlaFormat class object is used to format the output.
       DecimalFormat df=new DecimalFormat("#.##");
       //Scanner class object is sued to read the inputs entered by the user
Scanner sc=new Scanner(System.in);
  
//Getting the data from the user
System.out.print("Enter First Name :");
fname=sc.next();
System.out.print("Enter Last Name :");
lname=sc.next();
System.out.print("Enter Gender(M/F):");
gender=sc.next(".").charAt(0);
System.out.print("Enter Birth Year:");
year=sc.nextInt();
System.out.print("Enter Birth Month:");
month=sc.nextInt();
System.out.print("Enter Birth day:");
day=sc.nextInt();
System.out.print("Enter Height(in inches):");
height=sc.nextInt();
System.out.print("Enter Weight(in Pounds):");
weight=sc.nextInt();
  
//Creating the HealthProfile Object by passing the data as input
HealthProfile hp=new HealthProfile(fname, lname, gender, month, day, year, height, weight);
  
//Displaying the results by callling the method on the HealthProfile Object
System.out.println("Your Age is :"+hp.calAge());
System.out.println("Your Maximum Heart Rate is :"+hp.max_heartRate());
System.out.println("Your Target Heart Rate is :"+df.format(hp.target_heartRate()));
hp.calBMI();
  
  
   }

}

_____________________

output:

Enter First Name :Kane
Enter Last Name :Williams
Enter Gender(M/F):M
Enter Birth Year:1984
Enter Birth Month:5
Enter Birth day:6
Enter Height(in inches):170
Enter Weight(in Pounds):150
Your Age is :32
Your Maximum Heart Rate is :188
Your Target Heart Rate is :253.8
You are Obese

_________Thank You

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