Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Processing and Python Code: use processing with python code: For this problem. you will need to hand in your testing in a separate document.

Using Processing and Python Code:
image text in transcribed
image text in transcribed
image text in transcribed
use processing with python code: image text in transcribed
For this problem. you will need to hand in your testing in a separate document. This can be a simple text document if you like, where for each of the 6 test cases, you state something like: "I used A packages of franks and B packages of buns. This should yield a result of X total hotdogs My program gave a result of Y total hotdogs. Of course, if your program is working, X and Y will be the same, but the whole point of testing is not to assume that will be the case in advance! Next, start writing your code by creating a function called make_hotdogs (). This function should accept two parameters, the number of packages of franks and the number of packages of buns, and should follow these steps: Calculate how many franks and buns there are based on the number of packages of each Calculate how many complete hotdogs can be made (one frank per bun) Return the number of complete hotdogs you can make Once this function is done, you can (and should!) test it before adding any further components of the program. You can do this by just writing a few function calls with hard-coded, literal arguments and just printing out the return value You don't need to hand in this intermediate testing, but it's a good habit to get into and will save you time in the long run! Finally, add the interactive components to the program. This will include handling the keyboard input to modify the number of packages of franks and buns, as well as displaying the program's output to the Processing canvas Here's how the program might look like while it is running Packages of fans 2 packages olbuns 3 hoides made 24 Figure 2. Simple interface displaying the number of hot dogs that can be made Python sketch_210223a 18 18 19 A > Console del make_hotdogs(frPack, bnPack): Function that makes hot dogs # Converting Packages into units numFts frPack 12 numBn = bnPack - 8 # Returning number of hot dogs you can make if numFr>numen: return numBn else: return numer def main() Main function print("Pressing "'g' key Increases/Decreases the number of frank packages) print("Pressing by'n' key increases Decreases the number of bun packages") print("Pressing any other key to stop processing...) frankPack = 0 bunPack=0 # Iterate till user want to quit while True: # Reading user input ch=input #Processing input if ch.lower()==": frankPack 1 elif ch.lower() if frankPack > 0 frankPack-=1 else: print("No Frankies Available...") elif ch.lower(): bunPack+w1 elif ch lowerden: if bunPack > 0 bunPack-=1 olse: print("No Buns Available...) else: break Testing maximum number of hot dogs can be made # Converting Packages into units numFr = frankPack 12 numBn = bunPack 8 # Printing results print(" Il you have " + str(frankPack) +"packages of franks +strinumFt) + franks total) and

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions