Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem B: Calorie Counter In order to be successful, UCF needs to provide its tourists with helpful features that Disney and Universal dont have. Since

Problem B: Calorie Counter

In order to be successful, UCF needs to provide its tourists with helpful features that Disney and Universal dont have. Since people are more health conscious these days, UCF has decided that each park visitor will receive a calorimeter, which will gauge his/her net calorie gain or loss during the day.

The secret of course is that this device isnt perfect. It doesnt ACTUALLY measure the number of calories you burn or the number of calories you ingest. Instead, it makes four assumptions:

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 lost. 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 Samples

Samples of the program running are included below. Note that these samples are NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above.

Sample Run 1

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!

Sample Run 2

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

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

Students also viewed these Databases questions