Question: write a program that will perform these nutritional calculations. Specifically, you will produce an estimate of the total calories as follows: calestimated = 1.01XYZx

write a program that will perform these nutritional calculations. Specifically, you will

 produce an estimate of the total calories as follows: calestimated = 1.01XYZx 

write a program that will perform these nutritional calculations. Specifically, you will produce an estimate of the total calories as follows: calestimated = 1.01XYZx calotal = 1.01XYZ x (calfat + calcarb) The number of calories resulting from the fat are calculated by multiplying the fat grams by 9. calfat = fater x 9 Similarly, the number of calories that result from the carbohydrates are calculated as the carbohydrates grams multiplied by 4. calcarb = carbgr x 4 Your individual number is tied to the total calories so that there is some margin of error in the estimates For example, if a member reported fatgr = 150 of fat and carbgr = 300 of carbohydrates on a day and the individual number is 1.01123 then: calestimated = 1.01123 (150 x 9 + 300 4) calestimated = 2579 calories (rounded to the nearest calorie) 1. Develop an initial decomposition of the problem using the chevron notation (> and >>) from the module materials. Include your decomposition in your solution document. i. Building on your decomposition for part c.i., develop an algorithm for solving the problem. Include this algorithm in your solution document, and also write down your Pl and the individual number that you have obtained via Steps 1-3 from your Pl iii. Write a Python function definition following the instructions that are provided below. Save your function in a file called Q4_OUCU.py, where 'OUCU' is your OUCU number When you have completed your work on this part submit the py file with your function paste the function definition from your py file as text (with indentation preserved) into your solution document Instructions for writing the function: Provide a single Python function that implements the algorithm you wrote for part c.ii. Your function must be a translation of your algorithm from part c.ii.. otherwise no marks will be awarded.

Step by Step Solution

3.34 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the initial decomposition for the problem calculatetotalcaloriesfatgr carbg... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!