Java BMI GUI

import javax.swing.JOptionPane;
class bmi{
public static void main(String args[]){
String ipr;
String h = JOptionPane.showInputDialog("Height in inchers:");
String w = JOptionPane.showInputDialog("Waight in kilograms:");

double hh = Double.parseDouble(h);
double ww = Double.parseDouble(w);

double bb = ww/((hh*0.0254)*(hh*0.0254));


if (bb<16)
ipr = "seriously underweight ";
else if(bb<18)
ipr = "underweight";
else if(bb<24)
ipr = "normal weight";
else if (bb<29)
ipr = "overweight";
else if (bb<35)
ipr = "seriously overweight ";
else
ipr = "gravely overweight";
JOptionPane.showMessageDialog(null, "Your BMI= "+ bb + "\n" + "Health State: " + ipr);
}
}

Ceylon Dream Bully Kennel

Thank you for watching!

No comments:

Post a Comment

මොකුත් නොකිය යන්න එපා!Do not go no saying, place comment!

ඔබට බොහෝම ස්තුතියි !, Thank you!