2.8. Cookie Calories – Java

Hello everyone, in this program, i created a variable userStringOutput, which will be used to store the user’s input. Because it’s storing the user’s input, it’s best to call it userStringInput or whatever similar that makes sense to you. What i meant by userStringOutput was a variable to store user input. As long as you understand that userStringOutput is used to store user input, that’s great and I’m happy 🙂 Take care everyone. Much Love 😊

Starting out with Java: From control structures through objects
Chapter 2
Programming Challenges

8. Cookie Calories

A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 servings in the bag and that a serving equals 300 calories. Write a program that lets the user enter the number of cookies he or she actually ate and then reports the number of total calories consumed.

Gaddis, Tony (2015-05-29). Starting Out with Java: From Control Structures through Objects (6th Edition) (Page 106). Pearson. Kindle Edition.

Learn Java – https://www.youtube.com/playlist?list=PLGFLoZ9w5xCMDOxkwYMQ4jbqisJxdc4Q6

Learn Python – https://www.youtube.com/playlist?list=PLGFLoZ9w5xCNa8Lb6QVlWx7JUoiG3kqkg

Programming challenges, Starting out with Java by Tony Gaddis – https://www.youtube.com/playlist?list=PLGFLoZ9w5xCP2OFHwY6EZq-IIG7JFcdHQ

Programming challenges, Starting out with Python by Tony Gaddis, https://www.youtube.com/playlist?list=PLGFLoZ9w5xCMCvDnylUHIG16hkt90F0sc

Thanks 😊

source