Tuesday, 30 July 2013

TO CHECK UR BMI INDEX USE THE FOLLOWING SCRIPT IN NETBEANS AND CHANGE TEXTFEILD NAME ACORDINGLY


(1FT=3.48 CM)
FOR CALCULATE BUTTON :

tring name=jTextField1.getText();                                            // TO TAKE NAME
float w=Float.parseFloat(jTextField2.getText());                    // TO TAKE WEIGHT OF THAT PERSON
float h=Float.parseFloat(jTextField3.getText());  // TO TAKE HEIGHT OF THAT PERSON (IN
                                                                                                                                                  METERS)
float bmi=0;
bmi=w/(h*h);
jTextField4.setText(bmi+" ");                           //TO GIVE BMI RESULT





if (optm.isSelected())  // optm is radio button male name
{
    if (bmi<17.5)
   JOptionPane.showMessageDialog(this,name+" you is anorexia");
    else if (bmi>=17.5&&bmi<20.7)
    JOptionPane.showMessageDialog(this,name+" you is underweight");
else if (bmi>=20.7&&bmi<26.4)
    JOptionPane.showMessageDialog(this,name +" you is in normal range");
else if (bmi>=26.4&&bmi<27.8)
    JOptionPane.showMessageDialog(this,name +" you is marginally overweight");
else if (bmi>=27.8&&bmi<31.1)
    JOptionPane.showMessageDialog(this,name +" you is overweight");
else if (bmi>=31.1&&bmi<35)
    JOptionPane.showMessageDialog(this,name +" you is very overweight or obese");
else if (bmi>=35&&bmi<40)
    JOptionPane.showMessageDialog(this,name +" you is severely obese");
else if (bmi>=40&&bmi<50)
    JOptionPane.showMessageDialog(this,name +" you is morbidly obese");
else if (bmi>=50&&bmi<60)
    JOptionPane.showMessageDialog(this,name +" you is super obese");

}
else if (optf.isSelected())                                         // optm is radio button female name
{
    if (bmi<17.5)
   JOptionPane.showMessageDialog(this,name+" you is anorexia");
    else if (bmi>=17.5&&bmi<19.1)
    JOptionPane.showMessageDialog(this,name+" you is underweight");
else if (bmi>=19.1&&bmi<25.8)
    JOptionPane.showMessageDialog(this,name +" you is in normal range");
else if (bmi>=25.8&&bmi<27.3)
    JOptionPane.showMessageDialog(this,name +" you is marginally overweight");
else if (bmi>=27.3&&bmi<32.3)
    JOptionPane.showMessageDialog(this,name +" you is overweight");
else if (bmi>=32.3&&bmi<35)
    JOptionPane.showMessageDialog(this,name +" you is very overweight or obese");
else if (bmi>=35&&bmi<40)
    JOptionPane.showMessageDialog(this,name +" you is severely obese");
else if (bmi>=40&&bmi<50)
    JOptionPane.showMessageDialog(this,name +" you is morbidly obese");
else if (bmi>=50&&bmi<60)
    JOptionPane.showMessageDialog(this,name +" you is super obese");

}


TO CLEAR ALL TEXT FROM TEXT BOX USE  FOLLOWING SCRIPT :

txtn.setText(" ");
txth.setText(" ");
txtw.setText(" ");
optm.setSelected(false);  
optf.setSelected(false);
txtbmi.setText(" ");

 TO CLOSE THE APPLICATION USE THE FOLLOWING SCRIPT :

System.exit(0);



IF YOU WANT TO KNOW MORE ,YOU CAN READ THESE BOOKS








2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. THANKS THAT REALLY HELP TO CREATE MY PROJECT,

    ReplyDelete