Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

# Nathan Mansmith

Greenhorn
since Sep 08, 2009
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
0
0
Total given
0
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

## Recent posts by Nathan Mansmith

so i have a range to compare and i am havning a hard time figuring out the code.

if the variable is
less than 18.5 then print Underweight
between 18.5 and 24.9 then print Normal
between 25 and 29.9 then print Overweight
30 or greater then print Obese

here is my code sofar

if(Num == 1){
System.out.print( "Enter Your wieght: " ); // prompt
weightLb = input.nextInt(); // read first number from user

System.out.print( "Enter Your hight: " ); // prompt
hightIn = input.nextInt(); // read second number from user

bmiS = (weightLb * 703)/(hightIn*hightIn); // body Mass Index in standared

if ( bmiS <= 18.4 ){
System.out.printf( "%s, %d, %s, which means your Underweight.", "Your BMI value is", bmiS );
}
if ( bmiS >= 30 ){
System.out.printf( "%s, %d, %s, which means your Obese.", "Your BMI value is", bmiS );
}
if ( bmiS < 24.9, bmiS > 18.5 ){
System.out.printf( "%s, %d, %s, which means your Normal.", "Your BMI value is", bmiS );
}
if ( bmis < 29.9, bmiS > 25){
System.out.printf( "%s, %d, %s, which means your Overweight.", "Your BMI value is", bmiS );
}
}
12 years ago