SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
Procedural Abstraction And Functions That Return A Value
Exercise:
Programming Projects
Question:14 | ISBN:9780321531346 | Edition: 7

Question

To maintain one’s body weight, an adult human needs to consume

enough calories daily to (1) meet the basal metabolic rate (energy

required to breath, maintain body temperature, etc.), (2) account for

physical activity such as exercise, and (3) account for the energy required

to digest the food that is being eaten. For an adult that weighs P pounds

we can estimate these caloric requirements using the following formulas:

1. Basal metabolic rate: Calories required = 70 * (P / 2.2)0.756

2. Physical activity: Calories required = 0.0385 * Intensity * P * Minutes

Here, Minutes is the number of minutes spent during the physical

activity, and Intensity is a number that estimates the intensity of the

activity. Here are some sample numbers for the range of values:

_A_c_t_iv_i_t_y____________________In_t_e_n_s_i_ty_

Running 10 mph: 17

Running 6 mph: 10

Basketball: 8

Walking 1 mph: 1

3. Energy to digest food: calories required = TotalCaloriesConsumed * 0.1

In other words, 10% of the calories we consume goes towards digestion.

Write a function that computes the calories required for the basal

metabolic rate, taking as input a parameter for the person’s weight. Write

another function that computes the calories required for physical activity,

taking as input parameters for the intensity, weight, and minutes spent

exercising.

Use these functions in a program that inputs a person’s weight, an

estimate for the intensity of physical activity, the number of minutes

spent performing the physical activity, and the number of calories in one

CHAPTER 4 / Procedural Abstraction and Functions That Return a Value

serving of your favorite food. The program should then calculate and

output how many servings of that food should be eaten per day to

maintain the person’s current weight at the specified activity level. The

computation should include the energy that is required to digest food.

You can find estimates of the caloric content of many foods on the web.

For example, a double cheeseburger has approximately 1000 calories.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Sorry the answer is not available at the moment…

If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.

Spread the 'tradition of sharing'.