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

Java Java Objects (Retired) Harnessing the Power of Objects Helper Methods

How to use a helper method?

How do I make GoKart return true if it is at max capacity?

1 Answer

faraz
PLUS
faraz
Courses Plus Student 21,474 Points

Hey 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!

Thanks Faraz, some solid advice you gave me.