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...
-
Accountants for Mainland Catering Service encountered the following situations while adjusting and closing the books at December 31. Consider each situation independently. a. The company bookkeeper...
-
What accounting policies would best serve the reporting objective of tax minimization?
-
The sums of the degrees of the vertices of two graphs are equal, but the two graphs are not isomorphic. Determine whether each statement is always true, sometimes true, or never true.
-
Hernandez, which has been an S corporation since inception, is subject to tax in States Y and Z. On Schedule K of its Federal Form 1120S, Hernandez reported ordinary income of $500,000 from its...
-
Required information [ The following information applies to the questions displayed below. ] The Riesen Publishers ( TRP ) is a publisher of magazines. Its accounting policy for subscriptions...
-
Craig Fisher started a lawn service called Craigs Quick Cut to earn money over the summer months. Fisher has decided to use the following accounts for recording transactions: Assets Revenue Cash Lawn...
-
Knock Knock is a business selling furniture, owned by KK Enterprise. It had the following trial balance as at 31 December 2017: Debit Credit RM RM Cash 13,700 Account receivables 19,800 Inventory (1...
-
An investor sells a European call option with strike price of K and maturity T and buys a put with the same strike price and maturity. Describe the investor's position in terms of payoff and its...
-
(a) Show that the hypotheses "If you send me a WhatsApp message, then I will finish writing the Matlab program," "If you do not send me a WhatsApp message, then I will go to the cafe early" and "If I...
-
In the definition of culture, the key words are values, belief , idea and feelings a) Explain how each of those words fit in the definition of culture. b) Discuss the importance of those words in the...
-
How has the proportion of debt financing and equity financing changed over the years? (Compared to the average in the market). Is the corporation experiencing favorable or unfavorable financial...
-
Bilko and co. sells patented Industrial Sealant. It determines that its elasticity of demand is -2 and its marginal cost is $5 per unit. It has been charging $10 per unit. It should [Select] its...
-
The graph of g consists of two straight lines and a semicircle. Use it to evaluate each integral. y 12 12 9 0 (a) y = g(x) g(x) dx X 21 21 12 12 (b) Loto 9(x 18 g(x) dx (c) XQ g(x) dx
-
Give the products of the following reaction, where T is tritium: dioldehydrase Ad- CH CH3C-COH CoIII) coenzyme B12
-
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...
-
Bank Reconciliation (Partial)} The cash account for Feldman Company contains the following information for April: \section*{Required:} Assuming there were no deposits in transit at March 31 and that...
-
Bank Reconciliation} Valentine Investigations has the following information for its cash account: Valentine's bank statement for February contained the following information: A comparison of company...
-
What three elements make up audit risk? Define each.
Study smarter with the SolutionInn App