Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me write this program in codeblock C: 1) When walking, you burn 5 calories/minute 2) When standing in line, you burn 2 calories/minute.

Please help me write this program in codeblock C:

1) When walking, you burn 5 calories/minute

2) When standing in line, you burn 2 calories/minute. 3) When you are consuming solid food, you ingest 40 calories/minute.

4) When you are consuming a drink, you ingest 20 calories/minute.

The calorimeter is smart enough to know which of the four activities you are engaging in at any point in time, and at the end of the day, compiles a tally of how many minutes you spent doing each of these four activities. Write a program that takes these four values as input and outputs the pounds lost (we want a positive message for our clients). If the user has gained weight, print out a negative number for weight loss. Note, use the following constants for this problem:

#define WALK_CAL 5 #define STAND_CAL 2 #define DRINK_CAL 20 #define FOOD_CAL 40 #define CALS_PER_POUND 3500 

Input Specification

1. All four values will be non-negative integers less than 720, representing the number of minutes spent for each of the four activities.

Output Specification

When weight is lost, output a single line of the following format telling the user how many pounds they lost, rounded to 3 decimal places.

You lost X.XXX pounds today!

If weight is gained, output a single line of the following format, print out the weight change as a negative number rounded to 3 decimal places.

Weight lost is -X.XXX pounds.

Output sample 01:

How many minutes were you walking?

120

How many minutes were you standing?

230

How many minutes were you drinking?

20

How many minutes were you eating?

15

You lost 0.017 pounds today!

Output sample 02:

How many minutes were you walking?

120

How many minutes were you standing?

230

How many minutes were you drinking?

20

How many minutes were you eating?

17

Weight lost is -0.006 pounds.

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_2

Step: 3

blur-text-image_3

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions