Write a Java program to compute body mass index (BMI)
Test DataInput weight in pounds: 452Input height in inches: 72Expected Output:Body Mass Index is 61.30159143458721
import java.util.Scanner; public class Exercise6 { public static void main(String[] Strings) { Scanner input = new Scanner(System.in); System.out.print("Input weight in pounds: "); double weight = input.nextDouble(); System.out.print("Input height in inches: "); double inches = input.nextDouble(); double BMI = weight * 0.45359237 / (inches * 0.0254 * inches * 0.0254); System.out.print("Body Mass Index is " + BMI+"\n"); } }
Sample Output:
Input weight in pounds: 452 Input height in inches: 72 Body Mass Index is 61.30159143458721
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer