From 7167a7a6177718e2d9054edf7ff09ba3e0931626 Mon Sep 17 00:00:00 2001 From: KSHITIJ BARNWAL <73215352+kshibarn@users.noreply.github.com> Date: Fri, 28 Oct 2022 13:14:29 +0530 Subject: [PATCH] Adding Coffee_Shop.py --- Coffee_Shop.py | 91 ++++++++++++++++++ .../.gradle/7.4.2/checksums/checksums.lock | Bin 0 -> 17 bytes .../.gradle/7.4.2/fileChanges/last-build.bin | Bin 0 -> 1 bytes .../.gradle/7.4.2/fileHashes/fileHashes.lock | Bin 0 -> 17 bytes bmi app/android/.gradle/7.4.2/gc.properties | 0 bmi app/android/.gradle/vcs-1/gc.properties | 0 6 files changed, 91 insertions(+) create mode 100644 Coffee_Shop.py create mode 100644 bmi app/android/.gradle/7.4.2/checksums/checksums.lock create mode 100644 bmi app/android/.gradle/7.4.2/fileChanges/last-build.bin create mode 100644 bmi app/android/.gradle/7.4.2/fileHashes/fileHashes.lock create mode 100644 bmi app/android/.gradle/7.4.2/gc.properties create mode 100644 bmi app/android/.gradle/vcs-1/gc.properties diff --git a/Coffee_Shop.py b/Coffee_Shop.py new file mode 100644 index 000000000..9924356eb --- /dev/null +++ b/Coffee_Shop.py @@ -0,0 +1,91 @@ +class Menu: + coffee_type=["Espresso","Cappuccino","Latte"] + add_ons=["Milk","Cream","Latte"] + cost={"Espresso + Milk": 60, + "Espresso + Cream": 75, + "Espresso + Latte": 100, + "Cappuccino + Milk": 80, + "Cappuccino + Cream": 90, + "Cappuccino + Latte": 125, + "Latte + Milk": 100, + "Latte + Cream": 125, + "Latte + Latte": 150} + + + def getCoffeeName(self,user_option): + return self.coffee_type[user_option-1] + + def getAddOnName(self,user_option): + return self.add_ons[user_option-1] + + def getPrice(self,product): + return self.cost[product] + + +class CoffeeShop(Menu): + cart={} + def _init_(self): + print("Welcome to CoffeeShop!") + + def displayMenu(self): + print("Available Coffee Types:") + for i,coffee in enumerate(self.coffee_type): + print("{0}. {1}".format(i+1,coffee)) + print("Available Add-ons:") + for i,item in enumerate(self.add_ons): + print("{0}. {1}".format(i+1,item)) + print("Available Combinations:") + i=1 + for product,price in self.cost.items(): + print("{0}. {1} : Rs. {2}".format(i,product,price)) + i+=1 + self.getUserChoice() + + def getUserChoice(self): + #get falvour + coffee_flavour_num=int(input("Enter the coffee type(1-3):\n")) + while coffee_flavour_num>3: + print("Invalid option! Choose number between (1-3)") + coffee_flavour_num=int(input("Enter the coffee type(1-3):\n")) + coffee_flavour=self.getCoffeeName(coffee_flavour_num) + + #get addon + add_on_num=int(input("Enter the add-on(1-3):\n")) + while add_on_num>3: + print("Invalid option! Choose number between (1-3)") + add_on_num=int(input("Enter the add-on(1-3):\n")) + add_on=self.getAddOnName(add_on_num) + + #get quantity: + quantity=int(input("Quantity (no of coffees you want):\n")) + product="{0} + {1}".format(coffee_flavour,add_on) + + if product in self.cart: + self.cart[product]+=quantity + else: + self.cart[product]=quantity + + print(self.cart) + option=input("Would you like to order another coffee:\nType 'y' for yes and 'n' for no\n") + if option=="y": + self.displayMenu() + else: + self.calculateBill() + + def calculateBill(self): + total_amount=0 + print("\nBILL:") + for item,quantity in self.cart.items(): + product_price=self.getPrice(item) + amt=product_price*quantity + print("Coffee Combo : {0}".format(item)) + print("Price : {0}".format(product_price)) + print("Quantity : {0}".format(quantity)) + total_amount+=amt + + print("Total Amount to be Paid: Rs.{0}".format(total_amount)) + + + +shop=CoffeeShop() +shop.displayMenu() \ No newline at end of file diff --git a/bmi app/android/.gradle/7.4.2/checksums/checksums.lock b/bmi app/android/.gradle/7.4.2/checksums/checksums.lock new file mode 100644 index 0000000000000000000000000000000000000000..5e41367f0aa699fc3bf90d9feea2bcf9cdaf60d4 GIT binary patch literal 17 TcmZQ}eY1E%-8REt3{U_7I}ilN literal 0 HcmV?d00001 diff --git a/bmi app/android/.gradle/7.4.2/fileChanges/last-build.bin b/bmi app/android/.gradle/7.4.2/fileChanges/last-build.bin new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d GIT binary patch literal 1 IcmZPo000310RR91 literal 0 HcmV?d00001 diff --git a/bmi app/android/.gradle/7.4.2/fileHashes/fileHashes.lock b/bmi app/android/.gradle/7.4.2/fileHashes/fileHashes.lock new file mode 100644 index 0000000000000000000000000000000000000000..30f2f25a9649055321d41940ab4906d368af771e GIT binary patch literal 17 TcmZQxkysq)Ie9@D0~7!NF8u?; literal 0 HcmV?d00001 diff --git a/bmi app/android/.gradle/7.4.2/gc.properties b/bmi app/android/.gradle/7.4.2/gc.properties new file mode 100644 index 000000000..e69de29bb diff --git a/bmi app/android/.gradle/vcs-1/gc.properties b/bmi app/android/.gradle/vcs-1/gc.properties new file mode 100644 index 000000000..e69de29bb