write a program that will perform these nutritional calculations. Specifically, you will produce an estimate of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
Here is the initial decomposition for the problem calculatetotalcaloriesfatgr carbg... View the full answer
Related Book For
Microsoft Visual C# An Introduction to Object-Oriented Programming
ISBN: 978-1337102100
7th edition
Authors: Joyce Farrell
Posted Date:
Students also viewed these programming questions
-
1 The minimum variance portfolio problem min Er st. ex=1, px= R where the target return must be achieved exactly, short-selling is allowed, and the covariance matrix is assumed to be positive...
-
In the following reaction, choose the two correct starting materials from (a)-0). 40 "C, THF Br (a) (b) o (c) (d) (e) OHC -Ph Br Br Br Ph O Ph O O Ph (g) () Br- P-Ph (h) Ph Ph Ph Ph Ph Ph Ph Ph Ph Ph...
-
Angelo Bank is planning to replace some old ATM machines and has decided to use the York Machine. Anita Chavez, the controller, has prepared the analysis shown here. She has recommended the purchase...
-
Depletion ComputationsMining Henrik Mining Company purchased land on February 1, 2010, at a cost of $1,250,000. It estimated that a total of 60,000 tons of mineral was available for mining. After it...
-
Find the inverse for each function. Then graph the function and its inverse. If necessary, restrict the domain of f(x) so that the inverse is a function. 24-29. See Ch. 5 Answer Appendix. 24. f(x) =...
-
Kelly Services is an employment agency that places individuals in temporary positions. Kelly makes placements in accordance with business clients needs and preferences. Asthma Suliman, a Muslim...
-
Shiraz Rugs began operations on February 1. It uses a perpetual inventory system. During February, the company had the following purchases and sales. Instructions (a) Determine the ending inventory...
-
1. A scientific committee is to be formed form 6 Indians and 8 foreigners, which includes at least 2 Indians and double the number of foreigners as Indians. Then the number of ways the committee and...
-
Cooper River Glass Works (CRGW) produces four different models of desk lamps as shown in Figure. The operations manager knows that total monthly demand exceeds the capacity available for production....
-
If g(x) = 6 csc(x), then g'(x) =
-
What have researchers found about the idea that different types of business have different types of working capital.
-
This extract describes the accounting support available from a commercial provider to help house builders with costing. IDS Scheer North America, the leading provider of business process excellence...
-
Why are most correlations noncausal?
-
Facebook CEO Mark Zuckerbergs meteoric rise to social networking superstar is presented in this wellmade movie. Analyze the communication styles of conflict management used by Zuckerberg and others....
-
Why are collective inferential errors more likely when issues are emotionally charged?
-
How do magnetic stripes on the ocean floor serve as evidence forseafloor spreading? Select one: a. Their symmetry on either side of the mid-oceanridge shows that new crust is created, then split. b....
-
(a) Prove that form an orthonormal basis for R3 for the usual dot product. (b) Find the coordinates of v = (1, 1, 1)T relative to this basis. (c) Verify formula (5.5) in this particular case. 48-65...
-
What number will the following code display on the computer screen? int sum = 0; int y = 0; do { for (int x = 1; x
-
In this exercise, you will create a program that displays the amount of a cable bill. The amount is based on the type of customer, as shown in Figure 9-43. For a residential customer, the user will...
-
You have just purchased a new personal computer system. Before putting the system components together, you read the instruction booklet that came with the system. The booklet contains a list of the...
-
A standard gold bar stored at Fort Knox, Kentucky, is 7.00 inches long, 3.63 inches wide, and 1.75 inches tall. Gold has a density of \(19,300 \mathrm{~kg} / \mathrm{m}^{3}\). What is the mass of...
-
A typical timber wolf has a mass of \(40 \mathrm{~kg}\), a typical jackrabbit a mass of \(2.5 \mathrm{~kg}\). Given the scaling law presented in the passage, we'd expect the specific metabolic rate...
-
A typical timber wolf has a mass of \(40 \mathrm{~kg}\), a typical jackrabbit a mass of \(2.5 \mathrm{~kg}\). Given the scaling law presented in the passage, we'd expect the wolf to use times more...
Study smarter with the SolutionInn App