# 3. Donuts¶

Studios are in-class activities to give you hands-on practice with new concepts. The first half is the Walkthrough, an instructor-led programming problem. The second half is for you to work on individually or in pairs in class.

These problems are not graded, and you are not obligated to finish them. Get as far as you can while in class, and use them as an opportunity to play with and solidify new concepts.

## Walkthrough¶

Imagine you’re an American tourist in London. You’re very hungry, but can’t figure out how many orders of fish-and-chips you can afford. They cost £4.79 (4 pounds, 79 pence) for one order, but the conversion rates are confusing! Let’s write a program that asks

• The current dollar-to-pound exchange rate (eg, $1.00 is £0.76 right now when I’m writing this) • How many dollars you’re willing to spend. and tells us how many orders of fish-and-chips we can afford. ## Studio¶ Here’s the scenario: You run a hip new artisanal donut shop, the Loop Hole, which, in its short lifetime, has already rocked the boutique-desserts market with numerous “disruptions”, including: • a minimalist menu consisting of just one type of donut per day: Manager’s Special... always Manager’s Special. • giving customers the option to order fractional amounts of donuts, e.g. 1.7 donuts, please. • a progressive pay-what-you-want pricing system, in which the customer pays what s/he thinks is a fair price. (Of course, you do provide a “suggested price”.) Now it’s time to implement your latest innovation, an app via which users can pre-order donuts remotely from the convenience of... the command-line terminal on their computer. In the editor below, write a program which introduces the flavor of the day, and then takes the user’s order. Taking their order involves asking two questions: 1. How many donuts do they want to buy? 2. How much do you want to pay per donut? After getting input, you should: 1. Inform the user of the total cost of their order. 2. Don’t forget to include sales-tax, which is, let’s say, 5%. Here’s an example of how the finished program should behave. Note that lines starting with >>> represent user input. Welcome to the Loop Hole! Today's Manager's Special is: Crunch Jelly: A traditional jelly donut in which the jelly filling is made entirely of Capn' Crunch Oops! All Berries How many would you like? >>> 3.33333 How much would you like to pay per donut (suggested price is$4.35 each)?
>>> 2.5
Ok, let me prepare that for you....