Noob question about using ints in booleans
Okay. I know this is pretty basic stuff. Sorry. This is a trouble I have that I don't know how to deal with. I create a boolean if statement, and at some times it won't let my use int's. Of course I am using ints, but I get an error message "this method must return a type of int" because I created an if statement with booleans... but the return is a number, not a true/false. I just don't see what I'm doing wrong. Sample code:
/* calculates the total amount of time required to cook */
private int totalCookTime(int cookingLength, int foodAmount, int stoves, int cookingLengthMinutes) {
if (cookingLength > 0 && cookingLengthMinutes <= 0) {
return ((cookingLength*foodAmount)*MINUTES_IN_HOUR)/stoves;
} else if (cookingLength > 0 && cookingLengthMinutes > 0){
return (((cookingLength*foodAmount)*MINUTES_IN_HOUR)+cook ingLengthMinutes)/stoves;
} else if (cookingLength <= 0 && cookingLengthMinutes > 0) {
return (cookingLengthMinutes*foodAmount)/stoves;
}
}
of course in the body I have initiated all the parametres etc.
So sorry that this question is so dumb.
Oh, and I use Eclipse, if that makes a difference.
Thanks for your time.
Jo