BMI - Underweight");

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&quot;); if(bmi&gt;16%18&amp;&amp;bmi&lt;=18) JOptionPane.showMessageDialog(null,&quot;Your BMI is =&quot; + bmi + &quot; you are Underweight&quot;); if(bmi&gt;18%24&amp;&amp;bmi&lt;=24) JOptionPane.showMessageDialog(null,&quot;Your BMI is =&quot; + bmi + &quot; you are at Normal weight&quot;); if(bmi&gt;24%29&amp;&amp;bmi&lt;=29) JOptionPane.showMessageDialog(null,&quot;Your BMI is =&quot; + bmi + &quot; you are Overweight&quot;); if(bmi&gt;29%35&amp;&amp;bmi&lt;=35) JOptionPane.showMessageDialog(null,&quot;Your BMI is =&quot; + bmi + &quot; you are Seriously Overweight&quot;); if(bmi&gt;35) JOptionPane.showMessageDialog(null,&quot;Your BMI is =&quot; + bmi + &quot; you are Gravely Overweight&quot;); System.exit(0); }} }...
View Full Document

This note was uploaded on 10/04/2010 for the course COMPUTER S 106 taught by Professor Moore during the Spring '08 term at Clark Atlanta.

Ask a homework question - tutors are online