Write a JAVA Program for below.(Computerization of Health Records) A health care
ID: 3838492 • 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
run:
Enter first name: Bob
Enter last name: Smith
Enter gender: M
Enter height in inches: 67
Enter weight in pounds: 160
Enter year of birth: 1957
Enter current year: 2013
HEALTH PROFILE FOR: Bob Smith
Gender: M
Age: 56
Height (in inches): 67.0
Weight (in pounds): 160.0
Maximum heart rate: 164
Target heart rate range:
Minimum: 82
Maximum: 139
BMI: 25.056806
BMI VALUES
Underweight: less than 18.5
Normal: between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese: 30 or greater
BUILD SUCCESSFUL (total time: 1 minute 14 seconds)
Explanation / Answer
Find the program below. Here for calculating Heart Rate there is no procedure in question. See the program below and output. I created two java files Person.java and HealthProfile.java
Person.java
import java.time.LocalDate;
import java.time.Month;
import java.time.Period;
public class Person {
String firstName;
String lastName;
String gender;
int month;
int date;
int year;
float height;
float weight;
float bmi; //To store the bmi value
public Person(String firstName, String lastName, String gender, int month, int date, int year, float height,
float weight) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.gender = gender;
this.month = month;
this.date = date;
this.year = year;
this.height = height;
this.weight = weight;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDate() {
return date;
}
public void setDate(int date) {
this.date = date;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public float getHeight() {
return height;
}
public void setHeight(float height) {
this.height = height;
}
public float getWeight() {
return weight;
}
public void setWeight(float weight) {
this.weight = weight;
}
@Override
public String toString() {
return "Health Profile For: First Name=" + firstName +" "+ lastName + ", Gender=" + gender + ", DOB-Month=" + month
+ ", DOB-Date=" + date + ", DOB-Year=" + year + ", Age = "+calcAge() +" Years, Height(in Inches)=" + height + ", Weight(in Pounds)=" + weight
+ ", BMI=" +calcBMI() +" Body Status=" + calcStatus();
}
public int calcAge(){
LocalDate today = LocalDate.now();
LocalDate birthday = LocalDate.of(year, Month.of(month), date);
Period p = Period.between(birthday, today);
//Now access the values as below
return p.getYears(); //Returns the age
}
public float calcBMI(){
bmi = (weight * 703)/(height * height);
return bmi;
}
public String calcStatus() {
if(bmi < 18.5){
return "Underweight";
}else if(bmi >=18.5 && bmi <= 24.9){
return "Normal";
}else if(bmi >=25 && bmi <= 29.9){
return "Overweight";
}else if(bmi >=30){
return "Obese";
}
return null;
}
}
HealthProfile.java
import java.util.Scanner;
public class HealthProfile {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter the First Name");
String firstName = s.nextLine();
System.out.println("Enter the Last Name");
String lastName = s.nextLine();
System.out.println("Enter the Gender");
String gender = s.nextLine();
System.out.println("Enter the DOB- Month(in numeric)");
int month = Integer.parseInt(s.nextLine());
System.out.println("Enter the DOB- Date");
int date = Integer.parseInt(s.nextLine());
System.out.println("Enter the DOB- Year");
int year = Integer.parseInt(s.nextLine());
System.out.println("Enter the Height(in inches)");
float height = Float.parseFloat(s.nextLine());
System.out.println("Enter the Weight(in pounds)");
float weight = Float.parseFloat(s.nextLine());
Person p = new Person(firstName, lastName, gender, month, date, year, height, weight);
System.out.println(p.toString());
}
}
OUTPUT:
Enter the First Name
bags
Enter the Last Name
padma
Enter the Gender
male
Enter the DOB- Month(in numeric)
4
Enter the DOB- Date
28
Enter the DOB- Year
1993
Enter the Height(in inches)
6.1
Enter the Weight(in pounds)
150
Health Profile For: First Name=bags padma,
Gender=male,
DOB-Month=4, DOB-Date=28, DOB-Year=1993,
Age = 24 Years,
Height(in Inches)=6.1,
Weight(in Pounds)=150.0,
BMI=2833.9158
Body Status=Obese
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.