In: Computer Science
2.13 Program: Food receipt (Python 3)
1.Enter food item name: hot dog
Enter item price: 2
Enter item quantity: 5
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
Total cost: $ 10.0
2.Enter food item name: hot dog
Enter item price: 2
Enter item quantity: 5
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
Total cost: $ 10.0
Enter second food item name: ice cream
Enter item price: 2.50
Enter item quantity: 4
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
4 ice cream @ $ 2.5 = $ 10.0
Total cost: $ 20.0
3.Enter food item name: hot dog
Enter item price: 2
Enter item quantity: 5
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
Total cost: $ 10.0
Enter second food item name: ice cream
Enter item price: 2.50
Enter item quantity: 4
RECEIPT
5 hot dog @ $ 2.0 = $ 10.0
4 ice cream @ $ 2.5 = $ 10.0
Total cost: $ 20.0
15% gratuity: $ 3.0
Total with tip: $ 23.0
PLEASE GIVE THUMBS UP, THANKS
SAMPLE OUTPUT :
code:
@author: VISHAL
"""
item_name=list();
item_price=list();
item_quantity=list();
item_name.append(input("Enter food item name : "));
item_price.append(float(input("Enter item price : ")));
item_quantity.append(int(input("Enter item quntity : ")));
print("RECEIPT");
print(str(item_quantity[0])+" "+item_name[0]+" @
$"+str(item_price[0])+" =
$"+str(item_quantity[0]*item_price[0]));
item_name.append(input("Enter Second food item name : "));
item_price.append(float(input("Enter item price : ")));
item_quantity.append(int(input("Enter item quntity : ")));
print("RECEIPT");
print(str(item_quantity[0])+" "+item_name[0]+" @
$"+str(item_price[0])+" =
$"+str(item_quantity[0]*item_price[0]));
print(str(item_quantity[1])+" "+item_name[1]+" @
$"+str(item_price[1])+" =
$"+str(item_quantity[1]*item_price[1]));
total=(item_quantity[0]*item_price[0])+(item_quantity[1]*item_price[1]);
print("Total cost : $"+str(total));
gratuity=total*.15;
print("15% gratuity : $"+str(gratuity));
print("Total with tip : $"+str(total+gratuity))