-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise02_14.java
More file actions
26 lines (25 loc) · 824 Bytes
/
Exercise02_14.java
File metadata and controls
26 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package Chapter2;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Scanner;
/**
*
* @author jorda
*/
public class Exercise02_14 {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter your weight in pounds: ");
double pounds = input.nextDouble();
System.out.println("Enter your Height in inches: ");
double inches = input.nextDouble();
double kilograms = pounds * 0.45359237;
double meters = inches * 0.0254;
double sqrOfMeters = Math.pow(meters, 2);
double BMI = kilograms/sqrOfMeters;
System.out.println("BMI is: " + BMI);
}
}