Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ ASSIGNMENT: Write a program to display the number of calories burned during a run. You burn 3.9 calories every minute that you run -

C++

ASSIGNMENT:

Write a program to display the number of calories burned during a run. You burn 3.9 calories every minute that you run - store that number in a constant. Display a table showing the number of calories burned in 10, 15, 20, 25, and 30 minutes of running.

Create constants for 3.9 (the number of calories burned every minute), 10 (the starting minutes), 30 (the ending minutes), and 5 (the number of minutes that the loop increments by during each iteration).

To illustrate that this program could have been written using any of the 3 loops discussed, first display the table using a while loop, then re-display the table using a do-while loop, and finally re-display the table again using a for loop.

There is no input for this program.

Example Run #1: (bold type is what is entered by the user)

You burn 3.90 calories every minute you run. This shows how many calories you burn if you ran for 'x' minutes.

Minutes Calories ------- -------- Using a while loop 10 39.00 15 58.50 20 78.00 25 97.50 30 117.00

Using a do-while loop 10 39.00 15 58.50 20 78.00 25 97.50 30 117.00

Using a for loop 10 39.00 15 58.50 20 78.00 25 97.50 30 117.00

The example run shows EXACTLY how your program output will look.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions