Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python w PyCharm - Purpose: To practice using modules, functions, conditionals, and mixing strings and variables in print Degree of Difficulty: Moderate Daily Energy Expenditure

Python w PyCharm

-

image text in transcribedimage text in transcribedimage text in transcribed

Purpose: To practice using modules, functions, conditionals, and mixing strings and variables in print Degree of Difficulty: Moderate Daily Energy Expenditure and Consumption Profile for an Exercise Enthusiast statements. An exercise enthusiast wants to understand (visualize) their daily caloric expenditure and consumption per day given their weekly weight loss goal. To determine their caloric expenditure and consumption, they have to do three things as follows: (a) They have to determine their Basal Metabolic Rate (BMR) using the Mifflin-St Jeor equation shown be- low. Their BMR is the estimated number of calories a person burns per day when they are at rest. In other words, it is the number of calories a person should consume in a day to maintain their body-weight. Male : BMR 10W +6.25H -5A +5 Female : BMR-10W +6.25H -5A - 161 BMR Basal Metabolic Rate per day W-Weight of the enthusiast (in kg) H- Height of the enthusiast (in cm) A- Age of the enthusiast (b) They have to determine the net number of calories they should consume per day (Ncc) on the average to know how much weight (in pound) they should be losing per week (WL). The following equation shows how to calculate their weight loss (in pound) per week if their NCC and BMR are known. WL 7(BMR - NCC)/3500 Where: WL Weight loss (in pound) per week BMR - Basal Metabolic Rate per day NCC Net calorie consumed per day For example, to lose 1 pound per week, the enthusiast should consume a net calorie that is 500 less than their BMR per day. (Note: based on the formula, a negative WL means weight is gained.) (c) Finally, to know the number of calories they should burn per day to achieve their overall weekly weight loss goal, they have to specifically calculate calorie burned (CB) per day as follows: CB-CC -NCC Where: CB Calorie burned per day cc Calorie consumed per day NCC Net calorie consumed per day Let's assume that the enthusiast consumes 3000 calories per day on the average over a week period, and their weekly weight loss (WL) goal is 1 pound. How many calories do they need to burn per day given that their weight (W) is 165 pounds, their height (H) is 5 feet and their age (A) is 25. Note: to convert pound to kg and feet to cm, use the following equations: W(kg) - W(pound) * 0.45 H(cm)- H(feet) 30.48 Here's a guide for getting this program working. You should try your program out every time you reach a point where you've accomplished one of the items in the list. Don't wait to the end to try it out. This should be a very gradual process of getting something working, then moving on to the next part. In solving this question, you will be expected to create three program files: main.py" (which contains the main program from which required functions in some other modules will be called), energy.py' (a module which contains functions for calculating BMR, NCC and CB) and 'conversion.py" (a module which contains two functions for conveting weight (in pound) to weight (in kg), and height (in feet) to height (in cm)). Alright, let's begir! (a) Create a function called calculateBMR() in the module file named "energy.". This function will cal- culate the BMR of the enthusiast and return the value. Document it with a docstring (b) Create a second function called conv_pound_to_kg() in the module file named 'conversion.py. This function will convert the weight of the enthusiast in pound to kg and return the value. Document it with a docstring (c) Create a third function called conv_feet_to_cm () in the module file named 'conversion.py'. This func- tion will convert the height of the enthusiast in feet to cm and return the value. Document it with a docstring (d) Create the main program 'main.py'. Document it with a docstring. In the main file, import the two modules into your program and request the user to enter the following inputs from the keyboard: . Name . Weight (in pound) Heightin feet) Calories consumed (per day) Gender (M or F) Weight loss (in pound) per week The inputs will be stored in the variables name, W, H, A , CC, G and WL, respectively. energy.py' module and passing in the weight to be converted as an argument. version.py" module and passing in the height to be converted as an argument. (e) Convert the weight (in pound) to weight (in kg) by calling the conv-pound to_kg) function from the (f) Convert the height (in feet) to height (in cm) by calling the conv_feet_to_cm) function from the con (g) Calculate the BMR using one of the first two equations above. You will need an if statement to make a selection between male and female. Moreover, you will need to passinW, H, A and Gas arguments. (h) Calculate the NCC using the third equation above. (Hint: make NCC the subject of the formula and create the function calculateNCC ) in the pre-existing module file named 'energy.py: Then call it in the main program. Specifically, call the calculateNCC) function by passing in the arguments WL and BMR and returning the NCC value () Calculate the CB using the fourth equation by passing in the arguments CC and NCC. (Hint: create the function calculateCB ) in the pre-existing module file named "energy.py' and call it in the main pro- gram.) (j) Print out all three energy (BMR. CC, CB) values, with each well identified or labeled (see sample output below) Here's a guide for getting this program working. You should try your program out every time you reach a point where you've accomplished one of the items in the list. Don't wait to the end to try it out. This should be a very gradual process of getting something working, then moving on to the next part. Sample Input and Output Your console output should look something like this: Enter your name: Kim Enter your veight (in pound): 165 Enter your height (in feet): 5 Enter your age: 25 Enter your average calories consumed per day: 3000 Enter gender (M or F): M Enter the weight (in pound) you intend to lose per week: 1 Daily Caloric Expenditure and Consumption Profile for Kim Kim's Basal Metabolic Rate (BMR) is 1575.0 Kim's Calorie Consumed (CC) per day is: 3000.0 Kim's Calorie Burned (CB) per day is: 1925.0

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

13.1 Explain the strategic role of employee benefits.

Answered: 1 week ago