-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyRestaurant.py
118 lines (103 loc) · 3.66 KB
/
MyRestaurant.py
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
class restaurant():
def __init__(self):
"""
nutrition
"""
# (In grams / kilograms)
self.carbohydrate = [7.5]
self.protein = [1, 1.5]
self.fat = [1, 1.5]
# vitamin (In milligrams)
self.vitaminA = [0.8]
self.vitaminB3 = [10]
self.vitaminB6 = [1.2]
self.vitaminC = [100]
self.vitaminD = [0.0005, 0.01]
self.vitaminE = [12]
# inorganic salt (In milligrams)
self.calcium = [800, 1000]
self.sodium = [1500, 2300]
self.potassium = [2000]
self.chlorine = [1.5]
self.iron = [10, 20]
self.zinc = [12, 16]
self.phosphorus = [700, 900]
self.magnesium = [300, 350]
self.copper = [2]
# inorganic salt (In grams)
self.iodine = [150]
self.selenium = [50]
self.chromium = [50]
# (In grams)
self.cellulose = [10, 30]
def welcome(self):
# print('欢迎来到 -味の力 ⭐ 定义- 美食餐厅')
print('欢迎来到 --味の力 * 新定义-- 美食餐厅')
print('您可以下单喜欢的菜品')
def receipts(self):
tea = {'苏式龙井茶'}
juice = {'蜂蜜柠檬茶': "honney:60g, lemmon:50g"}
print('1. 苏式龙井茶 2. 柠檬蜂蜜茶')
def ingredients(self):
# change to sql charts later
# the unit of ingredients need to in accordance with the unit of nutrition
lemmon = {'heat': 358,
'carbohydrate': 81.8,
'fat': 3.1,
'protein': 1.5,
'cellulose': 1.3,
'vitaminA': 0.010,
'vitaminB1': 0.05,
'vitaminB2': 0.07,
'vitaminB3': 0.7,
'vitaminB12': 0,
'vitaminC': 25,
'vitaminE': 1.14,
'folicaci': 0,
'calcium' : 105,
'magnesium': 39,
'iron': 1.8,
'potassium': 237,
'zinc': 1.02,
'selenium': 0.65,
'iodine': 0
}
honney = {'heat': 321,
'carbohydrate': 75.6,
'fat': 1.9,
'protein': 0.4,
'cellulose': 0,
'vitaminA': 0,
'vitaminB1': 0,
'vitaminB2': 0.05,
'vitaminB3': 0,
'vitaminB12': 0,
'vitaminC': 3,
'vitaminE': 0,
'folicaci': 0,
'magnesium': 2,
'calcium' : 4,
'iron': 1,
'potassium': 28,
'zinc': 0.37,
'selenium': 0.15,
'iodine': 0,
}
def calculate(self):
"""
加一个菜就把菜的各组成成分输入进程序进行计算 传参a, b, c, d, e ...
"""
# a.protein.content + b.protein.content
total_protein = 1.5 * (50/100) + 0.4 * (50/100)
# times weights
expected_protein = ((self.protein[0] + self.protein[1]) / 2) * 60
percent_protein = (total_protein / expected_protein) * 100
print("蛋白质摄入量占一天总蛋白质摄入量的%.2f%%" % percent_protein)
print("...")
def viewer(self):
print("各项营养成分的充能柱状图")
myrestaurant = restaurant()
myrestaurant.welcome()
myrestaurant.receipts()
myrestaurant.calculate()
myrestaurant.viewer()