Issue
I made a BMI calculator. One of the things I have to do is add categories using if statements. 18.5 to 24.9 normal weight so that would be one of the categories.
This is the way I have tried to do it.
else if ( (bmi >18.5) && (<24.9))
Obviously this won't work for me, what way should I write this I feel like there is a way to write 18.5 to 24.9 instead of using greater than or equal to but I honestly don't even know what to look up.
Link to code http://pastebin.com/gNE7VwE1
Solution
Use
if ( bmi > 18.5 && bmi < 24.9)
Unfortunately, Java does not support a 'BETWEEN' operator (like what SQL does e.g).
Answered By - Mohammed Aouf Zouag
Answer Checked By - David Goodson (JavaFixing Volunteer)