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 trialAndile javu
520 PointsHow to use a helper method?
How do I make GoKart return true if it is at max capacity?
1 Answer
faraz
Courses Plus Student 21,474 PointsHey Andile! If you are having trouble solving this task, go back to the video and re-watch it and see 01:41 for the instructions on how to make a helper method. You would need to follow the same template for this task, just with different variables and values.
For the first task, creating isBatteryEmpty, you need it to return a boolean which checks if the mBarsCount is less than 1, meaning that there are no bars and therefore the battery is empty. For the second task, creating isFullyCharged, you need to return a boolean if the mBarsCount is equivalent to the MAX_BARS, meaning that the battery is fully charged to it's max capacity, the MAX_BARS constant. If you're still having trouble, comment below and I'll help you solve it. Good luck!
Andile javu
520 PointsAndile javu
520 PointsThanks Faraz, some solid advice you gave me.
faraz
Courses Plus Student 21,474 Pointsfaraz
Courses Plus Student 21,474 PointsNo problem, glad I could help! :)