Answer to Question #237770 in Python for Caleb

Question #237770

#1 Food Plate #1(wings)​​​$18

​#2 Food Plate #2 (chicken strips)​​12

​#3 Food Plate #3 (fish basket)​​12

​#4 Food Plate #4 (shrimp po boy)​​15

​#5 Food Plate #5 (pork chop basket)​​12

Write a program to ask customers to enter their first name and the menu item # they wish to purchase. The program should define a function to assign the price to the food item based on what the customer purchases. Call the function in the program to determine the cost of the food plate. for this program customers will only purchase one food plate. Then ask the customer if they would like to add a tip and how much. Add tax of 9% to the cost of the food item, add in the tip amount and display their total bill.  Do not include the tip when you calculate tax. The tip is extra after tax is charged on the food. Be sure to display a $ when displaying the total and 2 decimal

 


1
Expert's answer
2021-09-16T01:47:15-0400
def get_price(n):
    if n == 1:
        price = 18
    elif n == 2:
        price = 12
    elif n == 3:
        price = 12
    elif n == 4:
        price = 15
    elif n == 5:
        price = 12
    return price

def main():
    plate = 0
    name = input('Enter your name: ')
    while not (1 <= plate <= 5):
        print('You can coose Food Plate:')
        print('      #1 wings')
        print('      #2 chicken strips')
        print('      #3 fish basket')
        print('      #4 shrimp po boy')
        print('      #5 pork chop basket')
        plate = int(input('Make you choice: '))   
    price = get_price(plate)
    ans = input('Whould you like to add a tips (Y/n)? ')
    if ans == 'N' or ans == 'n':
        tips = 0
    else:
        tips = float(input('Enter amount ofthe tips '))
    total = price*1.09 + tips

    print(f'\nDear {name}, your total price is ${total:.2f}')

main()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS