2.14* (Health
application: computing BMI) Body Mass Index (BMI) is a
measure of health on weight. It can be calculated by taking your weight in
kilograms and dividing by the square of your height in meters. Write a program
that prompts the user to enter a weight in pounds and height in inches and
display the BMI. Note that one pound is 0.45359237 kilograms
and one inch is 0.0254 meters.
Code :
File name-Bmi.java
import java.util.*;
import javax.swing.*;
public class Bmi {
public static void main (String arg[]){
Scanner input= new Scanner (System.in);
System.out.print("Enter weight in
pound: = ");
double weight = input.nextDouble();
System.out.print("Enter Heigiht in
inch: = ");
double height= input.nextDouble();
double weightk= weight*0.45359237;
double heightm= (height*0.0254);
double bmi =
(weightk)/(heightm*heightm);
System.out.print("BMI is: =
"+ bmi);
}
}