Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.6 kB
3
Indexable
Never
#Lab 4.5(2)
#Define variables
burgerPrice = 0.99
friesPrice = 0.79
sodaPrice = 1.09

burgerQty = 0
friesQty = 0
sodaQty = 0
tax = 0.06
keepOrdering = True
keepGoing = True

print('***Welcome to Yum Yum Burger App***')
while keepGoing == True: #outer loop
    totalPriceBeforeTax = 0
    while keepOrdering == True: #nested loop(loop inside a loop)
        print('Menu')
        print('Enter 1 for Yum Yum Burger')
        print('Enter 2 for Grease Yum Fries')
        print('Enter 3 for Soda Yum')
        menuSelected = int(input('Please enter a number(1/2/3): '))


        if menuSelected == 1:
            burgerQty += int(input('Enter amount of burger you want : '))
                
        elif menuSelected == 2:
            friesQty += int(input('Enter amount of fries you want : '))
                    
        elif menuSelected == 3:
            sodaQty += int(input('Enter amount of soda you want : '))
        else:
            print('Invalid option, please enter number 1, 2, or 3')
        menuSelected = input('Do you want to end the order (yes/no)')
        if (menuSelected == 'yes'):
            keepOrdering = False
    totalBeforeTax = (burgerQty*burgerPrice + friesQty*friesPrice + sodaQty*sodaPrice)
    taxPrice = totalBeforeTax*tax
    totalPrice = totalBeforeTax + taxPrice
    print('The price before tax is', totalBeforeTax)
    print('The total price is $',totalPrice)
    menuSelected = input('Do you want to end the program? (yes/no)')
    if menuSelected == 'yes':
        keepGoing = False
    else:
        keepOrdering = True
print('Enjoy you meal')