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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![David O'Mahoney](https://secure.gravatar.com/avatar/40db3c5e1732da8d4917820b4065c4c8?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
David O'Mahoney
869 PointsOverloading Methods Challenge. Help needed.
Hi there, I cannot seem to answer this task correctly, I've spent an hour on it and I'm getting nowhere. Any help would be much appreciated. The preview console doesn't seem to be much help at all.
Thanks, Dave.
class GoKart {
public static final int MAX_BARS = 8;
private String color;
private int barCount;
private int lapsDriven;
public GoKart(String color) {
this.color = color;
}
public String getColor() {
return color;
}
public void charge() {
barCount = MAX_BARS;
}
public boolean isBatteryEmpty() {
return barCount == 0;
}
public boolean isFullyCharged() {
return MAX_BARS == barCount;
}
public int drive( int lapsDriven) {
lapsDriven++;
barCount--;
}
}
4 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYou've added the argument, but you still need to do the part of the instructions that say "Update the method body to handle the new parameter." That means instead of increasing/decreasing by one, you'll need to modify the internal variables by the amount in the parameter. Also:
- updating the body will be easier to do if the parameter name is different from the internal variables
- this method still does not return anything (is still "void")
![David O'Mahoney](https://secure.gravatar.com/avatar/40db3c5e1732da8d4917820b4065c4c8?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
David O'Mahoney
869 PointsThanks Steven, I have tried to answer the objective with the code you have suggested and it still doesn't seem to work. I think maybe the page is not checking the work correctly.
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThat definitely should work for task 1. Are you on task 2?
![David O'Mahoney](https://secure.gravatar.com/avatar/40db3c5e1732da8d4917820b4065c4c8?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
David O'Mahoney
869 PointsYeah I am on task 1, it must be something wrong with the page, which is frustrating. Thanks again for your help.
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsTry restarting the browser and then perhaps your machine itself.
![Mark Harrigan](https://uploads.teamtreehouse.com/production/profile-photos/10760531/micro_May_Profile_Pic_2020.jpg)
Mark Harrigan
7,686 PointsCan confirm the above worked for me, thank you Steven!
David O'Mahoney
869 PointsDavid O'Mahoney
869 PointsHi Steven, thank you for your help, unfortunately after a couple more hours I still can't get the correct answer, I just really don't understand it, think I'm going to have to give up on this track, which is frustrating as I was enjoying it!
I'm sorry for what was probably a very simple question but I'm completely new to any sort of coding and I'm finding very difficult.
Thanks again for you help.
Steven Parker
230,688 PointsSteven Parker
230,688 PointsIn case it helps, here's an example of what it might look like with my hints applied: