subject

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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 20:40
On nba 2k 19, every time i try to join a my park game, it leads ro a website telling my dad that he needs ps plus. i already have ps plus though. how do i fix this?
Answers: 2
question
Computers and Technology, 24.06.2019 16:00
Which type of cloud computing offers easily accessible software and applications on the machines
Answers: 1
question
Computers and Technology, 25.06.2019 08:50
The purpose of this problem is to write some small functions and practice passing things around amoung functions.1) the main function shall ask the user to enter three numbers and read the three numbers.2) write a function named findsum that takes three numbers as arguments and returns their sum. the main function shall call this function.3) write a function named findaverage that takes the sum and the number of numbers and returns the average. the main function shall call this function.4) write a function named findsmallest that takes the three numbers and returns the smallest value. the main function shall call this function.5) the main function shall print the results in the following format, with two decimal positions and the decimal points aligned:
Answers: 3
question
Computers and Technology, 25.06.2019 12:00
The print command in the powerpoint is found in the? file tab home tab design tab review tab
Answers: 1
You know the right answer?
Java Eclipse Homework Calories Package : chall12A
Class : Calories

Use a “while l...
Questions
question
History, 18.01.2021 22:30
question
Mathematics, 18.01.2021 22:30
question
Physics, 18.01.2021 22:30
question
Mathematics, 18.01.2021 22:30
Questions on the website: 13722361