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 trialEdward Zhou
401 Pointswhy do you need "int runningTotal = 0" in the beginning?
why do you need "int runningTotal = 0" in the beginning? especially when the total is definitely not zero.
2 Answers
Ethan M
10,637 PointsHi, the integer variable must be set otherwise the program won't know where to start from. If you didn't have runningTotal then you wouldn't be able to add up and show the client how many minutes they've worked out for..
Christian Higgins
15,758 PointsAt the very beginning before anyone adds minutes for the first time, the total IS zero.
Ethan M
10,637 PointsEthan M
10,637 PointsIt's basically a container to add all the clients minutes and display it.