- Mar 19, 2006
- 1,539
- 1
- 81
It's this.
Thus far, the code I've written is the following:
However, I get the following error code after it refuses to compile: This method must return a result of type int.
I don't understand why it doesn't work. I'm returning integers ("return 0, return 1, return 2). Can anyone point me in the right direction?
Thus far, the code I've written is the following:
public int caughtSpeeding(int speed, boolean isBirthday)
{
if(speed <=60 || (speed <= 65 && isBirthday))
{
return 0;
}
if(speed >=61 && speed <=80 || (speed >= 66 && speed <= 86 && isBirthday))
{
return 1;
}
if(speed >= 81 || (speed >= 86 && isBirthday))
{
return 2;
}
}
However, I get the following error code after it refuses to compile: This method must return a result of type int.
I don't understand why it doesn't work. I'm returning integers ("return 0, return 1, return 2). Can anyone point me in the right direction?
