Hi!
I am having such a hard time creating my code its for a donut shop order form you enter your name and once you select ur type, and quantity it prints out a recipt like the one below.. I have everything figured out EXCEPT, I cant figure out how to multiply the quantity by the price.. any assistance would be so greatly appreciated, im new to this and struggling so hard. Ive also attached what i have so far for my code that is working
I am having such a hard time creating my code its for a donut shop order form you enter your name and once you select ur type, and quantity it prints out a recipt like the one below.. I have everything figured out EXCEPT, I cant figure out how to multiply the quantity by the price.. any assistance would be so greatly appreciated, im new to this and struggling so hard. Ive also attached what i have so far for my code that is working
Output:Dave, here is your receipt:
-------------------------------
12 Chocolate-dipped Maple Puffs
-------------------------------
Total cost: $42.00.
Thank you, have a nice day!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
print ( "Welcome, to Dino's International Doughnut Shoppe!" ) name = input ( "Please enter your name to begin!:" ) fileout = open ( "Dinos.txt" , "w" ) fileout.write(name + "\n" ) fileout.close() print ( "Please select a doughnut from the following menu:" ) print ( "1. Chocolate-dipped Maple Puff ($3.50 each)" ) print ( "2. Strawberry Twizzler ($2.25 each)" ) print ( "3. Vanilla Chai Strudel ($4.05 each)" ) print ( "4. Honey-drizzled Lemon Dutchie ($1.99)" ) x = int ( input ()) if x > 4 : print ( "I'm sorry, that's not a valid selection. Please enter a selection from 1-4." ) x = int ( input ()) if x = = 1 : print ( "How many Chocolate-dipped Maple Puffs would you like to purchase?" ) fileout = open ( "Dinos.txt" , "a" ) fileout.write( "Chocolate- dipped Maple Puffs\n" ) fileout.write( str ( "3.50\n" )) fileout.close() if x = = 2 : print ( "How many Strawberry Twizzlers would you like to purchase?" ) fileout = open ( "Dinos.txt" , "a" ) fileout.write( "Strawberry Twizzlers\n" ) fileout.write( str ( "2.25\n" )) fileout.close() if x = = 3 : print ( "How many Vanilla Chai Strudels would you like to purchase?" ) fileout = open ( "Dinos.txt" , "a" ) fileout.write( "Vanilla Chai Strudels\n" ) fileout.write( str ( "4.05\n" )) fileout.close() if x = = 4 : print ( "How many Honey-drizzled Lemon Dutchies would you like to purchase?" ) fileout = open ( "Dinos.txt" , "a" ) fileout.write( "Honey-drizzled Lemon Dutchies\n" ) fileout.write( str ( "1.99\n" )) fileout.close() Qty = input () fileout = open ( "Dinos.txt" , "a" ) fileout.write(Qty + "\n" ) fileout.close () filein = open ( "Dinos.txt" , "r" ) for i in range ( 0 - 4 ): for line in "Dinos.txt" : data = line.split( "\n" ) name = data [ 0 ] itemCode = float (data[ 1 ]) itemPrice = float (data[ 2 ]) itemQty = float (data[ 3 ]) print (name + ", here is your recipt:" ) print ( "-------------------------------" ) itemCode = filein.readline().strip() itemPrice = (filein.readline().strip()) itemQty = (filein.readline().strip()) print (Qty + itemPrice) print ( "-------------------------------" ) print ( "Total cost: $" ) print (itemQty * Qty ) print ( "Thank you, have a nice day" ) filein.close() |