Interface
double weight = Double.parseDouble(jTextField5.getText());
double heigth = Double.parseDouble(jTextField2.getText())
int gender = jComboBox1.getSelectedIndex();
double result = 0;
double imc;
imc = (weight/(heigth*heigth));
if (((gender==0) && (imc<20.7)) || ((gender==1) && (imc<19.1)))
{
jTextField1.setText("Underweigth");
}
else if (((gender==0) && (imc>=20.7 && imc<=26.4)) || ((gender==1) && (imc>=19.1 && imc>=25.8)))
{
jTextField1.setText("Normal Weigth");
}
else if (((gender==0) && (imc>26.4 && imc<27.8)) || ((gender==1) && (imc>25.8 && imc<27.3)))
{
jTextField1.setText("Slightly Overweight");
}
else if (((gender==0) && (imc>=27.8 && imc<=31.1)) || ((gender==1) && (imc>=27.3 && imc<=32.3)))
{
jTextField1.setText("Overweight");
}
else if (((gender==0) && (imc>32.1)) || ((sexo==1) && (imc>32.3)))
{
jTextField1.setText("Obese");
}
if (gender==0)
{
result = ((72.7*(height/100))-58);
}
else if (gender==1)
{
result = ((62.1*(height/100))-44.7);
}
jTextField3.setText(String.valueOf(Math.round(result)));
}
imc = (weight/(heigth*heigth));
if (((gender==0) && (imc<20.7)) || ((gender==1) && (imc<19.1)))
{
jTextField1.setText("Underweigth");
}
else if (((gender==0) && (imc>=20.7 && imc<=26.4)) || ((gender==1) && (imc>=19.1 && imc>=25.8)))
{
jTextField1.setText("Normal Weigth");
}
else if (((gender==0) && (imc>26.4 && imc<27.8)) || ((gender==1) && (imc>25.8 && imc<27.3)))
{
jTextField1.setText("Slightly Overweight");
}
else if (((gender==0) && (imc>=27.8 && imc<=31.1)) || ((gender==1) && (imc>=27.3 && imc<=32.3)))
{
jTextField1.setText("Overweight");
}
else if (((gender==0) && (imc>32.1)) || ((sexo==1) && (imc>32.3)))
{
jTextField1.setText("Obese");
}
if (gender==0)
{
result = ((72.7*(height/100))-58);
}
else if (gender==1)
{
result = ((62.1*(height/100))-44.7);
}
jTextField3.setText(String.valueOf(Math.round(result)));
}
No comments:
Post a Comment