Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Page 1 of 2 CIS 1 6 5 HW 2 : Shortbread Calculator 2 0 Points Shortbread. Who doesn t love it , and with

Page
1
of 2
CIS165
HW2: Shortbread Calculator
20 Points
Shortbread. Who doesnt love it, and with just three ingredients, who couldnt make it? And with
your help, this dense, buttery treat is about to get even easier.
Your Task
Code a Python Shortbread Calculator that will allow a user to 1) customize a recipe size and 2)
view nutritional information. A simple shortbread cookie recipe uses 1C butter, (1)/(2)C sugar, and
2C flour to make 16 cookies. Your calculator will display custom ingredient amounts for any
number of cookies the user enters. For example, the following user is wanting to make a half recipe
of 8 cookies (of which they will eat 4). User input is circled to differentiate it from output:
A recipe of 4 cookies (and eating 2) will produce the following output:
Use the following data in your calculations:
Standard Shortbread Recipe 16 Cookies
Butter 1 Cup
Sugar (1)/(2) Cup
Flour 2 Cups
Nutritional Data 1 Cookie
Calories 160
Carbs 18g
Fat 12g
You may approach this any way you like, but one way would be to begin your program by
calculating the ingredient portions for ONE cookie (by dividing each of the original recipe portions
by 16), and then multiply those results by the users desired number of cookies. The nutritional
data are already given per 1 cookie, so that will be just straight multiplication.
Since decimal lengths will vary depending on recipe sizes, Ill advise you not to fiddle with
decimal formatting at all this program. Well have plenty of opportunities to use that technique
later.
When youre done, submit your .py file (or zipped .py file as a .zip) through Canvas.

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

More Books

Students also viewed these Databases questions