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 trialsyalih
16,468 Pointsmethod named isFullyCharged
Please Help me I cant find solution
public class GoKart {
public static final int MAX_BARS = 8;
private String mColor;
private int mBarsCount;
public GoKart(String color) {
mColor = color;
mBarsCount = 0;
}
public boolean isFullyCharged(){
mBarsCount == MAX_BARS;
return ;
}
public void isFullyCharged(){
mBarsCount == MAX_BARS;
}
public String getColor() {
return mColor;
}
}
3 Answers
James Tyranski
3,957 PointsSure, first make sure you get rid of:
public void isFullyCharged(){
mBarsCount == MAX_BARS;
}
Then, try this for your isFullyCharged method to return the count:
public boolean isFullyCharged(){
return mBarsCount == MAX_BARS;
}
James Tyranski
3,957 PointsCouple of things I see. First is you have two methods with the same name, one returns a boolean and the other doesn't return anything (void). I believe you are on the part of the exercise where you want to return the boolean, so get rid of the other method which has void.
Then you need to finish your boolean method of isFullyCharged because it's incomplete. Without giving you the full answer, use what you learned from PezDispenser.java in your workspace. See specifically the 'public boolean dispense()' method as a reference, as this will be very much like that.
syalih
16,468 Pointscan you please paste the code here please I dont understand how???
MUZ140069 Mike Madziya
4,744 Pointsthanks James
syalih
16,468 Pointssyalih
16,468 PointsThank You So Much :) Works Gr8