Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BMICalc {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int feet, inches, pounds;
- double meters, kilograms, bmi;
- System.out.print("Enter your height:\nfeet: ");
- feet = in.nextInt();
- System.out.print("inches: ");
- inches = in.nextInt();
- System.out.print("What is your weight? (in pounds): ");
- pounds = in.nextInt();
- meters = (inches + (feet * 12)) * 0.0254;
- kilograms = pounds / 2.2;
- bmi = kilograms / (meters * meters);
- System.out.printf("A %d foot by %d inch adult of %d pounds has a BMI of %.1f%n",
- feet, inches, pounds, bmi);
- } // main()
- } // class BMICalc
Advertisement
Add Comment
Please, Sign In to add comment