Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKyle Dudley
604 PointsTask one is no longer passing.
Idk why anymore.
class GoKart {
public static final int MAX_BARS = 8;
private String color;
private int barCount;
public GoKart(String color) {
this.color = color;
}
public boolean isBatteryEmpty() {
return barCount == 0;
}
public String isFullyCharged() {
if ( barCount == 8 ) {
console.printf("Full!");
}
}
}
}
public String getColor() {
return color;
}
public void charge() {
barCount = MAX_BARS;
}
}
1 Answer
John McCartan
549 Pointspublic boolean isFullyCharged() { return barCount == MAX_BARS; }
From what I understand, the barCount needs to equal the max amount of bars.
Also from looking, you have many '{}' these can mess up the code, hope this has helped.
Łukasz Kusowski
13,422 PointsŁukasz Kusowski
13,422 PointsThe error message is quite unintuitive - I also had a problem with it. If you click "GO TO TASK ONE" the code from task two gets replaced by the working code from task one. What you have to do is:
I hope the explanation is clear enough :)