caughtSpeeding
From ggc
http://www.javabat.com/prob?id=Logic.caughtSpeeding
if(isBirthday==true || speed<=40) { return 0; } if(speed>=61 && speed<=80) { return 1; } if(speed>=60 && speed<=81) { return 0; } else { return 2; }
This is the code I have so far, but i need more to finish. This solves all but two of the situations.
Solution
public int caughtSpeeding(int speed, boolean isBirthday) {
if (isBirthday && speed <=65)
{return 0;}
if (isBirthday && speed >=66 && speed <=85)
{return 1;}
if (isBirthday && speed >=86)
{return 2;}
if (speed <=60)
{return 0;}
if (speed >=61 && speed <= 80)
{return 1;}
if (speed >=81)
{return 2;}
else {return 2;}
- This page was last modified on 1 April 2008, at 23:22.
- This page has been accessed 660 times.
- Privacy policy
- About ggc
- Disclaimers
- Powered by MediaWiki!









