{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

BMI - Underweight" if(bmi>16&&bmi<=18...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import javax.swing.JOptionPane; public class BMI { public static void main(String[] args) { String weight = JOptionPane.showInputDialog(null,"Enter your weight in pounds"); int p= Integer.parseInt(weight); String height = JOptionPane.showInputDialog(null,"Enter your height in inches"); int h = Integer.parseInt(height); double kg = p * 0.4539237; double i = h * .0254; double bmi = kg/h * h; JOptionPane.showMessageDialog(null,"Your weight in inches is = " + h + " inches"); JOptionPane.showMessageDialog(null,"Your height in meters is = " + i + " meters"); JOptionPane.showMessageDialog(null,"Your weight in pounds is = " + p + " pounds"); if(bmi<16) JOptionPane.showMessageDialog(null,"Your BMI is =" + bmi + " you are Seriously
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Underweight"); if(bmi>16%18&&bmi<=18) JOptionPane.showMessageDialog(null,"Your BMI is =" + bmi + " you are Underweight"); if(bmi>18%24&&bmi<=24) JOptionPane.showMessageDialog(null,"Your BMI is =" + bmi + " you are at Normal weight"); if(bmi>24%29&&bmi<=29) JOptionPane.showMessageDialog(null,"Your BMI is =" + bmi + " you are Overweight"); if(bmi>29%35&&bmi<=35) JOptionPane.showMessageDialog(null,"Your BMI is =" + bmi + " you are Seriously Overweight"); if(bmi>35) JOptionPane.showMessageDialog(null,"Your BMI is =" + bmi + " you are Gravely Overweight"); System.exit(0); }} }...
View Full Document

{[ snackBarMessage ]}