-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseStructure.py
More file actions
130 lines (111 loc) · 4.36 KB
/
BaseStructure.py
File metadata and controls
130 lines (111 loc) · 4.36 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
from dataBaseConnection import *
# coffee class identification (according to coffee ingredients)
class Coffee():
__doc__ = "This Class created for coffe type"
def __init__(self,coffeeName,price,coffeeRate,water=0,milk = 0,milkFoam = 0,chocolate = 0,ice = 0):
self.coffeeName = coffeeName
self.price = price
self.coffeeRate = coffeeRate
self.water = water
self.milk = milk
self.milk_foam = milkFoam
self.chocolate = chocolate
self.ice = ice
# Return Coffee size and price for bill
def cupSizeForPrice(self):
price = self.price
while True:
try:
size = int(input(f"""
Size For Cup
{"-"*28}
1- Tall (355ml) : {self.price}
2- Grande (473ml) : {self.price*1.15}
3- Venti (591ml ) : {self.price*1.27}
Please choice for size : """))
if size == 1:
return price
if size == 2:
price *= 1.15
return price
if size == 3:
price *= 1.27
return price
except:
print("\nInvalid size Please choice from table ")
# price calculation for each coffee class
class Revenue(Coffee):
__doc__ = "This Class Created For End of day Revenue"
def __init__(self,coffeeName,price,revenue):
self.revenue = revenue
self.result = 0
super().__init__(coffeeName,price,revenue)
# Customer is Pay the Bill
def isPaying(self):
beenpaid = input("Has money been paid (Y/N):")
while True :
if beenpaid.capitalize() == "Y":
print("""
Payment Successful
Returning to main menu...""")
return True
if beenpaid.capitalize() == "N":
print("""
Payment Failed
Returning to main menu... """)
return False
else:
print("\nPlease Select Y or N")
return self.isPaying()
# function to print bill on display
def bill(self,result):
VAT = 18
print("-"*50)
print(f"""
Your Bill:
{result}
without VAT(Value-Added Tax ) :
{result/(1+VAT/100)}
""")
print("-"*50)
if self.isPaying():
insertDaily(result)
# Create table , Run CupSizeForPrice Function and return
def Revenue(self):
createTable()
self.result = self.cupSizeForPrice()
return self.result
# Function to print Total End of Day Revenue to Display
def totalRevenue(self,day):
try :
dailyRevenue = 0
datas = getDailyDatas()
for data in datas:
dailyRevenue += data[2]
print(f"""
_ _ _ _ _ _ _ _ _ _ _ _ _
|
| {day}. DAY TOTAL : {dailyRevenue}
|_ _ _ _ _ _ _ _ _ _ _ _ _
""")
insertDailyRevenue(datas,dailyRevenue,day)
dropDaily()
except:
print("\nPlease Sale the Coffee")
# coffee identification for Ingredients
espresso = Coffee("Espresso",30,0.8)
americano = Coffee("Americano",35,0.3,0.7)
iceAmericano = Coffee("Ice Americano",40,0.3,0.7,ice=1)
latte = Coffee("Latte",45,0.2,0,0.6,0.2)
iceLatte = Coffee("Ice Latte",50,0.2,0,0.6,0.2,ice=1)
cappucino = Coffee("Cappucino",42,0.2,0,0.2,0.6)
mocha = Coffee("Mocha",55,0.3,0,0.4,0.1,0.2)
# Coffe identification for Revenue (Total Price)
revenue = Revenue("",0,0)
espressoRevenue = Revenue(espresso.coffeeName,espresso.price,0)
americanoRevenue = Revenue(americano.coffeeName,americano.price,0)
latteRevenue = Revenue(latte.coffeeName,latte.price,0)
iceAmericanoRevenue = Revenue(iceAmericano.coffeeName,iceAmericano.price,0)
icelatteRevenue = Revenue(iceLatte.coffeeName,iceLatte.price,0)
cappucinoRevenue = Revenue(cappucino.coffeeName,cappucino.price,0)
mochaRevenue = Revenue(mocha.coffeeName,mocha.price,0)