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 trialLana Wong
3,968 PointsCommuted Properties: On 2nd part, says first task is wrong. Why?
I completed the first task. But when I checked the second task, the compiler said that Task 1 is wrong. I go back to Task 1, check it, and it's correct. Although when I'm back at Task 2, the compiler continues to say that Task 1 is wrong. Why?
class GoKart {
public static final int MAX_BARS = 8;
private String color;
private int barCount;
public GoKart(String color) {
this.color = color;
}
public String getColor() {
return color;
}
public void charge() {
barCount = MAX_BARS;
}
public boolean isBatteryEmpty(){
if (barCount == 0){
return true;
}else{
return false;
}
}
public boolean isFullyCharged(){
return barCount == MAX_BARS;
}
}
}
1 Answer
michaelcodes
5,604 PointsHi there, after running your code I was able to get it pass by making 1 change, there was an extra } closing brace at the very end. Remove that and your all set :)
Take care and happy coding
Livia Galeazzi
Java Web Development Techdegree Graduate 21,083 PointsLivia Galeazzi
Java Web Development Techdegree Graduate 21,083 PointsWhen your previous tasks stop passing it's usually because your code no longer compiles. When your code doesn't compile, all the tests fail.