Win a copy of Head First Android this week in the Android forum!

Nathan Mansmith

Greenhorn
+ Follow
since Sep 08, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand 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