-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBMI.java
More file actions
40 lines (28 loc) · 1.18 KB
/
Copy pathBMI.java
File metadata and controls
40 lines (28 loc) · 1.18 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package oopproject1;
import javax.swing.JOptionPane;
public class BMI {
{
String W = JOptionPane.showInputDialog(null,"Enter Your Weight(KG): ", "BMI",JOptionPane.PLAIN_MESSAGE);
double w = Double.parseDouble(W);
String H = JOptionPane.showInputDialog(null,"Enter Your Height(cm): ", "BMI",JOptionPane.PLAIN_MESSAGE);
double h = Double.parseDouble(H);
h = h / 100;
double Pritherani = w / (h * h);
String PritheRani = Double.toString(Pritherani);
String b;
if (Pritherani < 18.5) {
JOptionPane.showMessageDialog(null, "Less than 18.5");
b = "Underweight";
} else if ((Pritherani) >= 18.5 || (Pritherani) <= 24.9) {
JOptionPane.showMessageDialog(null, "Between 18.5 and 24.9");
b = "Normal";
} else if (Pritherani >= 25 || Pritherani <= 29.9) {
JOptionPane.showMessageDialog(null, "Between 25 and 29.9");
b = "Overweight";
} else {
JOptionPane.showMessageDialog(null, "Greater than 30");
b = "Obese";
}
JOptionPane.showMessageDialog(null, "BMI: "+PritheRani + "("+b+")");
}
}