Indeks Massa Tubuh

Assalamualaikum wr. wb. . .
Kali ini saya akan membagikan car amenghitung indeks massa tubuh kita, .

Langsung saja di coba yaaa, . .

import java.util.Scanner;

public class BodyMassIndex {

public static void main(String[] iriahus) {
final double POUND_TO_KG = 0.45359237;
final double INCH_TO_M = 0.0254;

@SuppressWarnings("resource")
Scanner s = new Scanner(System.in);

System.out.print("Enter weight in pounds: ");
double pound = s.nextDouble();

System.out.print("Enter height in inches: ");
double inch = s.nextDouble();

double kg = pound * POUND_TO_KG;
double m = inch * INCH_TO_M;
double bmi = kg / (m * m);

System.out.println("BMI is " + bmi);

if (bmi < 18.5) {
System.out.println("Underweight");
}
else if (bmi < 25.0) {
System.out.println("Normal");
}
else if (bmi < 30) {
System.out.println("Overweight");
} else {
System.out.println("Obese");
}
}
}

Semoga bermanfaat, . . Thanks for visiting, . .

Subscribe to receive free email updates:

0 Response to "Indeks Massa Tubuh"

Post a Comment