why is this code not working?
From ggc
(caughtSpeeding)Im not sure what else to put in to make this code work.
This was my attempt:
public int caughtSpeeding(int speed, boolean isBirthday) {
if (speed >= 81)
{return 2;}
else if (speed >= 61 && speed <= 80)
{return 1;}
else
{ return 0;}
}
Answer
In general, if you don't use a parameter in the JavaBat problem, you probably do not fully take into account all of the information you need to take into account. For example, the code above works the same way regardless of whether it is your birthday or not. Doesn't the problem description say that things should happen differently depending upon whether it is your birthday or not?
- This page was last modified on 2 April 2008, at 19:13.
- This page has been accessed 218 times.
- Privacy policy
- About ggc
- Disclaimers
- Powered by MediaWiki!









