Computers and Technology

Java Eclipse Homework Calories Package : chall12A
Class : Calories

Use a “while loop” in the code to solve the following problem:

Over a 14-day period, calculate the total number of calories that the user consumed.
Use the following information to create the necessary code. You will use a while loop in this code.

1. The following variables will need to be of type “int”:
• day
• calories
• totalCalories
1. Show a title on the screen for the program.
2. Ask the user if they want to run the program.
3. Initialize (give values) to those variables that need starting values.
4. If their answer is a capital or lowercase ‘Y’, do the following:
• Use a while loop to loop through the days.
• Ask the user for the number of calories he/she consumed on each day. Please • include the day number in your question. Example: “How many calories did you consume on day 1?”
Include the calculation to keep a running total of the calories consumed.
1. After 14 days, the code should fall out of the loop. Include a print statement that looks like this: “After 14 days, you consumed calories.” (Of course, the computer will need to fill in the total number.)
2. Include an “else” so that there is an appropriate response if the user decides not to run the program.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 10:50, Isaiahtate053
Write a 3-4 page apa formatted paper comparing your organization’s it strategy with the best practices outlined in your course text. content should include, but not be limited to: developing and delivering on the it value, developing it strategy for the business value and linking it to business metrics. your paper should include an abstract and a conclusion and a reference page with 3-5 references
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, eila3601
As with any small island country, cuba has fewer natural resources than countries such as brazil. this affects their economy in that cuba a) exports only manufactured products. b) exports more products than it imports.. c) must import more products than it exports. d) has imposed trade barriers against the united states.
Answers: 3
image
Computers and Technology, 23.06.2019 02:30, paolaviviana
Experimental data that is expressed using numbers is said to be
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, small77
Font size, font style, and are all aspects of character formatting.
Answers: 2
Do you know the correct answer?
Java Eclipse Homework Calories Package : chall12A
Class : Calories

Use a “while l...

Questions in other subjects: