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

you are to write a java program that records the health profile. you will design

ID: 3810300 • Letter: Y

Question

you are to write a java program that records the health profile. you will design a “starter” HealthProfile program for a person. The program should include the person’s age, height (in inches), and weight (in pounds). The program also should include functions that calculate maximum heart rate and target heart rate, and body mass index (BMI). The program should prompt for the person’s information from that variable – including age, height and weight – then it should calculate and display the BMI,
maximum heart rate and target heart rate range. Use the following formula to calculate BMI, maximum heart rate and target heart rate range:
************************************************************************
Formula:

Maximum Heart Rate = 220 – age
Target Heart Rate Range = 50 – 80 % of Maximum Heart Rate
************************************************************************
The program should notify to the user what the BMI value means. BMI values will be determined as follows:
************************************************************************
If BMI value is in 19 to 24, he/she is "Normal".
If BMI value is in 25 to 29, he/she is "Overweight".
If BMI value is in 30 to 39, he/she is "Obese".
If BMI value is bigger than 40, he/she is "Extreme Obesity".
************************************************************************
The program should keep asking the user to input data if he/she has more to calculate. The program allows decimal places. Therefore, variables used in this program should have the proper data type. Output of the program should be well formatted, readable, and professional.
1. Declare variable names and proper data type of each variable. (5) 2. Import scanner class for user input. (5) 3. Add data entered by a user using do/while loop. (35) 4. Calculate and decide BMI value. (5) 5. Calculate Maximum heart rate and target heart rate. (5) 6. All output values must have two decimal places. (10) 7. Well-formatted, readable, and professional output. (25) 8. Ask a user input more data after each calculation. If no more data to input, program stops. (10)
9. Your output should look like following:

*****************************************************************  

Explanation / Answer

BMICalculator.java

import java.util.Scanner;

public class BMICalculator {

   public static void main(String[] args) {

       // Declaring variables
       int age;
       double height, weight;
       char ch;

       // This loop continues to execute until the user enters'y' or 'Y'
       do {
           // Scanner object is used to get the inputs entered by the user
           Scanner sc = new Scanner(System.in);

           // getting the inputs entered by the user
           System.out.print("Enter the Person's Age :");
           age = sc.nextInt();

           System.out.print("Enter the Person's Height (in inches) :");
           height = sc.nextDouble();

           System.out.print("Enter the Person's Weight :");
           weight = sc.nextInt();

           // calculating the BMI
           double BMI = calculateBMI(weight, height);

           // calculating the Max heart rate
           double maxHeartRate = calMaxHeartrate(age);

           System.out.printf("Your BMI is %.2f ", BMI);
           // Based on the bmi value the corresponding block will be executed.
           if (BMI >= 19 && BMI <= 24) {
               // Displaying the result
               System.out.println("You are Normal");
           } else if (BMI >= 25 && BMI <= 29) {
               // Displaying the result
               System.out.println("You are Over Weight");
           } else if (BMI >= 30 && BMI <= 39) {
               // Displaying the result
               System.out.println("You are Obese");
           } else if (BMI >= 40) {
               // Displaying the result
               System.out.println("You are Extreme Obesity");
           }

           System.out.printf("Maximum Heart Rate is : %.2f ", maxHeartRate);

           // Calculating the target heart rate range
           calTargetHeartRate(maxHeartRate);

           // Getting the character from the user 'Y' or 'y' or 'N' or 'n'
           System.out.print(" Do you want to continue(Y/N) ::");
           ch = sc.next(".").charAt(0);

       } while (ch == 'y' || ch == 'Y');

   }

   private static double calculateBMI(double weight, double height) {

       return (weight / (height * height)) * 703;
   }

   private static void calTargetHeartRate(double maxHeartRate) {

       double minTargetHeartRate = (0.05) * maxHeartRate;
       double maxTargetHeartRate = (0.08) * maxHeartRate;

       System.out.printf("Target Heart Rate between %.2f and %.2f BMP. ",minTargetHeartRate, maxTargetHeartRate);
   }

   private static int calMaxHeartrate(int age) {

       return 220 - age;
   }

}

___________________

Output:

Enter the Person's Age :25
Enter the Person's Height (in inches) :31
Enter the Person's Weight :70
Your BMI is 51.21
You are Extreme Obesity
Maximum Heart Rate is : 195.00
Target Heart Rate between 9.75 and 15.60 BMP.

Do you want to continue(Y/N) ::y
Enter the Person's Age :29
Enter the Person's Height (in inches) :26
Enter the Person's Weight :90
Your BMI is 93.59
You are Extreme Obesity
Maximum Heart Rate is : 191.00
Target Heart Rate between 9.55 and 15.28 BMP.

Do you want to continue(Y/N) ::n

___________Thank You