-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMicrowave.py
More file actions
514 lines (494 loc) · 20.3 KB
/
Copy pathMicrowave.py
File metadata and controls
514 lines (494 loc) · 20.3 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
import time
import os
import csv
class comp:
def __init__(self, time:int, temp:int, moisture:int):
self.time = time*60
self.temp = temp
self.moisture = moisture
def moisture1(self, limit):
if self.moisture >= limit:
time = self.time
while time > 0:
self.moisture = self.moisture - (self.temp/1200)
if self.moisture <= limit:
break
time -= 1
class mode(comp):
def __init__(self, time, temp, moisture):
super().__init__(time, temp, moisture)
def quick_heat(self):
comp.moisture1(self, 40)
Microwave.display2(self)
def Deforst(self):
comp.moisture1(self, 60)
Microwave.display2(self)
def Grill(self):
comp.moisture1(self, 30)
Microwave.display2(self)
class vegetable(comp):
def __init__(self, time, temp, moisture):
super().__init__(time, temp, moisture)
def menu():
Microwave.display1()
print(" 1. brokoli")
print(" 2. wortel\n 3. kembang kol\n 4. bayam")
print(" 5. jagung manis\n 6. paprika")
print(" 7. zucchini")
def brokoli(self):
comp.moisture1(self, 70)
Microwave.display2(self)
def wortel(self):
comp.moisture1(self, 60)
Microwave.display2(self)
def kembang_kol(self):
comp.moisture1(self, 70)
Microwave.display2(self)
def bayam(self):
comp.moisture1(self, 80)
Microwave.display2(self)
def jagung_manis(self):
comp.moisture1(self, 70)
Microwave.display2(self)
def paprika(self):
comp.moisture1(self, 60)
Microwave.display2(self)
def zucchini(self):
comp.moisture1(self, 70)
Microwave.display2(self)
class seafood(comp):
def __init__(self, time, temp, moisture):
super().__init__(time, temp, moisture)
def menu():
Microwave.display1()
print(" 1. Ikan fillet")
print(" 2. Udang")
print(" 3. Cumi-cumi")
print(" 4. Kerang")
print(" 5. Lobster")
def fish(self):
comp.moisture1(self, 70)
Microwave.display2(self)
def shrimp(self):
comp.moisture1(self, 75)
Microwave.display2(self)
def squid(self):
comp.moisture1(self, 70)
Microwave.display2(self)
def shellfish(self):
comp.moisture1(self, 70)
Microwave.display2(self)
def lobster(self):
comp.moisture1(self, 70)
Microwave.display2(self)
class incode(comp):
def __init__(self, time:int, temp:int, moisture:int, barcode:int, namefood):
super().__init__(time, temp, moisture)
self.barcode = barcode
namefood = namefood
def detect(self, code):
csvfile = open('barcodes.csv', newline='')
foodcode = csv.reader(csvfile)
next(foodcode)
barcode = []
namefood = []
timefood = []
tempfood = []
moisturefood = []
for row in foodcode:
barcode.append(int(row[1]))
namefood.append(row[2])
timefood.append(int(row[3])*60)
tempfood.append(int(row[4]))
moisturefood.append(int(row[5]))
csvfile.close()
for i in range(len(barcode)):
if code == barcode[i]:
self.namefood = namefood[i]
self.barcode = barcode[i]
self.time = timefood[i]
self.temp = tempfood[i]
self.moisture = moisturefood[i]
break
def cook(self):
comp.moisture1(self, 0)
Microwave.display2(self)
class Microwave(comp):
def __init__(self, time, temp, moisture):
super().__init__(time, temp, moisture)
def displayup():
print('='*38)
print('||',end='')
print('='*18,end='')
print('||',end='')
print('='*14,end='')
print('||')
def displaydown():
print('||',end='')
print('='*18,end='')
print('||',end='')
print('='*14,end='')
print('||')
print('='*38)
def display1():
Microwave.displayup()
side_v = 6
while side_v>0:
side_h = 38
while side_h>0:
if (side_h == 38) or (side_h == 37) or (side_h == 18) or (side_h == 17) or (side_h == 2):
print('|', end='')
elif (side_h == 1):
print('|')
elif side_h<37 and side_h>18:
print(' ',end='')
elif side_h == 16:
if side_v == 6:
print(f'Temp || --- ||',end='')
elif side_v == 5:
print(f'Time ||--:--||',end='')
elif side_v == 4:
print(f'Mois || --- ||',end='')
elif side_v == 3:
print(" _ _ _ _ _ ___",end='')
elif side_v == 2:
print("|1|3|4|5|6| ",end='')
else:
print("|7|8|0| 99|___",end='')
side_h-=1
side_v-=1
Microwave.displaydown()
def display2(self):
while self.time >= 0:
os.system('cls')
Microwave.displayup()
side_v = 6
while side_v>0:
side_h = 38
while side_h>0:
if (side_h == 38) or (side_h == 37) or (side_h == 18) or (side_h == 17) or (side_h == 2):
print('|', end='')
elif (side_h == 1):
print('|')
elif side_h<37 and side_h>18:
print(' ',end='')
elif side_h == 16:
if side_v == 6:
if self.temp < 10:
print(f'Temp || {self.temp}°C ||',end='')
elif self.temp < 100:
print(f'Temp || {self.temp}°C||',end='')
else:
print(f'Temp ||{self.temp}°C||',end='')
elif side_v == 5:
min, sec = divmod(self.time, 60)
print(f'Time ||{min:02d}:{sec:02d}||',end='')
elif side_v == 4:
moisture = self.moisture + (self.temp/1500)*self.time
if moisture <10:
print(f'Mois || {int(round(moisture, 0))}%||',end='')
elif moisture<100:
print(f'Mois || {int(round(moisture, 0))}%||',end='')
else:
moisture = 100
print(f'Mois || {int(round(moisture, 0))}%||',end='')
elif side_v == 3:
print(" _ _ _ _ _ ___",end='')
elif side_v == 2:
print("|1|3|4|5|6| ",end='')
else:
print("|7|8|0| 99|___",end='')
side_h-=1
side_v-=1
Microwave.displaydown()
time.sleep(0.0001)
self.time -= 1
def displayover(self):
Microwave.displayup()
side_v = 6
while side_v>0:
side_h = 38
while side_h>0:
if (side_h == 38) or (side_h == 37) or (side_h == 18) or (side_h == 17) or (side_h == 2):
print('|', end='')
elif (side_h == 1):
print('|')
elif side_h<37 and side_h>18:
if side_v == 4:
if side_h>29 or side_h<26:
print(' ',end='')
elif side_h == 29:
print("OVER", end='')
elif side_v == 3:
if side_h>29 or side_h<26:
print(' ',end='')
elif side_h == 29:
print("COOK", end='')
else:
print(' ',end='')
elif side_h == 16:
if side_v == 6:
if self.temp < 10:
print(f'Temp || {self.temp}°C ||',end='')
elif self.temp < 100:
print(f'Temp || {self.temp}°C||',end='')
else:
print(f'Temp ||{self.temp}°C||',end='')
elif side_v == 5:
print(f'Time ||00:00||',end='')
elif side_v == 4:
if self.moisture<10:
print(f'Mois || {int(round(self.moisture, 0))}%||',end='')
else:
print(f'Mois || {int(round(self.moisture, 0))}%||',end='')
elif side_v == 3:
print(" _ _ _ _ _ ___",end='')
elif side_v == 2:
print("|1|3|4|5|6| ",end='')
else:
print("|7|8|0| 99|___",end='')
side_h-=1
side_v-=1
Microwave.displaydown()
def displaydry(self):
Microwave.displayup()
side_v = 6
while side_v>0:
side_h = 38
while side_h>0:
if (side_h == 38) or (side_h == 37) or (side_h == 18) or (side_h == 17) or (side_h == 2):
print('|', end='')
elif (side_h == 1):
print('|')
elif side_h<37 and side_h>18:
if side_v == 4:
if side_h>29 or side_h<27:
print(' ',end='')
elif side_h == 29:
print("DRY", end='')
elif side_v == 3:
if side_h>29 or side_h<26:
print(' ',end='')
elif side_h == 29:
print("COOK", end='')
else:
print(' ',end='')
elif side_h == 16:
if side_v == 6:
if self.temp < 10:
print(f'Temp || {self.temp}°C ||',end='')
elif self.temp < 100:
print(f'Temp || {self.temp}°C||',end='')
else:
print(f'Temp ||{self.temp}°C||',end='')
elif side_v == 5:
print(f'Time ||00:00||',end='')
elif side_v == 4:
if self.moisture<10:
print(f'Mois || {int(round(self.moisture, 0))}%||',end='')
else:
print(f'Mois || {int(round(self.moisture, 0))}%||',end='')
elif side_v == 3:
print(" _ _ _ _ _ ___",end='')
elif side_v == 2:
print("|1|3|4|5|6| ",end='')
else:
print("|7|8|0| 99|___",end='')
side_h-=1
side_v-=1
Microwave.displaydown()
def displaydone(self):
Microwave.displayup()
side_v = 6
while side_v>0:
side_h = 38
while side_h>0:
if (side_h == 38) or (side_h == 37) or (side_h == 18) or (side_h == 17) or (side_h == 2):
print('|', end='')
elif (side_h == 1):
print('|')
elif side_h<37 and side_h>18:
if side_v == 4:
if side_h>29 or side_h<26:
print(' ',end='')
elif side_h == 29:
print("WELL", end='')
elif side_v == 3:
if side_h>29 or side_h<26:
print(' ',end='')
elif side_h == 29:
print("DONE", end='')
else:
print(' ',end='')
elif side_h == 16:
if side_v == 6:
if self.temp < 10:
print(f'Temp || {self.temp}°C ||',end='')
elif self.temp < 100:
print(f'Temp || {self.temp}°C||',end='')
else:
print(f'Temp ||{self.temp}°C||',end='')
elif side_v == 5:
print(f'Time ||00:00||',end='')
elif side_v == 4:
if self.moisture<10:
print(f'Mois || {int(round(self.moisture, 0))}%||',end='')
else:
print(f'Mois || {int(round(self.moisture, 0))}%||',end='')
elif side_v == 3:
print(" _ _ _ _ _ ___",end='')
elif side_v == 2:
print("|1|3|4|5|6| ",end='')
else:
print("|7|8|0| 99|___",end='')
side_h-=1
side_v-=1
Microwave.displaydown()
def menu():
print(f'======================================')
print(f'||1. Manual mode ||6. Seafood ||')
print(f'||==================================||')
print(f'||2. Quick Heat ||7. input kode ||')
print(f'||==================================||')
print(f'||3. Defrost ||8. Cleaning ||')
print(f'||==================================||')
print(f'||4. Grill ||0. Stop ||')
print(f'||==================================||')
print(f'||5. Vegetable ||99. Child Lock ||')
print(f'||==================================||')
def menulock():
print(f'======================================')
print(f'||1. Manual mode🔒||6. Seafood🔒 ||')
print(f'||==================================||')
print(f'||2. Quick Heat🔒 ||7. input kode🔒 ||')
print(f'||==================================||')
print(f'||3. Defrost🔒 ||8. Cleaning🔒 ||')
print(f'||==================================||')
print(f'||4. Grill🔒 ||0. Stop🔒 ||')
print(f'||==================================||')
print(f'||5. Vegetable🔒 ||99.Child Lock🔒 ||')
print(f'||==================================||')
def Start():
ChildLock = False
Microwave.display1()
while True:
if ChildLock == False:
Microwave.menu()
choice = int(input("Pilih menu : "))
os.system('cls')
if choice == 1:
Microwave.display1()
time = int(input("Masukan waktu Memasak(menit) : "))
temp = int(input("Masukan Temperatur(°C) : "))
moisture = 100
food = Microwave(time, temp, moisture)
food.moisture1(0.8)
food.display2()
if food.moisture < 1:
os.system('cls')
food.displaydry()
elif food.moisture < 40:
os.system('cls')
food.displayover()
else:
os.system('cls')
food.displaydone()
elif choice == 2:
food = mode(2, 150, 90)
food.quick_heat()
elif choice == 3:
food = mode(8, 40, 90)
food.Deforst()
elif choice == 4:
food = mode(7, 230, 100)
food.Grill()
elif choice == 5:
while True:
vegetable.menu()
sayur = int(input("Pilih Sayur : "))
os.system('cls')
if sayur == 1:
vegen = vegetable(2, 200, 100)
vegen.brokoli()
break
elif sayur == 2:
vegen = vegetable(4, 200, 100)
vegen.wortel()
break
elif sayur == 3:
vegen = vegetable(4, 180, 100)
vegen.kembang_kol()
break
elif sayur == 4:
vegen = vegetable(3, 160, 100)
vegen.bayam()
break
elif sayur == 5:
vegen = vegetable(4, 180, 100)
vegen.jagung_manis()
break
elif sayur == 6:
vegen = vegetable(4, 200, 100)
vegen.paprika()
break
elif sayur == 7:
vegen = vegetable(4, 180, 100)
vegen.zucchini()
break
elif choice == 6:
while True:
seafood.menu()
seaf = int(input("Pilih Seafood : "))
if seaf == 1:
ikan = seafood(5, 90, 100)
ikan.fish()
break
elif seaf == 2:
udang = seafood(3, 80, 100)
udang.shrimp()
break
elif seaf == 3:
cumi = seafood(3, 80, 100)
cumi.squid()
break
elif seaf == 4:
kerang = seafood(4, 80, 100)
kerang.shellfish()
break
elif seaf == 5:
lobster = seafood(7, 90, 100)
lobster.lobster()
break
elif choice == 7:
while True:
code = int(input("Masukan Code barcode: "))
food = incode(0,0,0,0,0)
food.detect(code)
confirm = input(f'{food.namefood}? (y/n): ').lower()
if confirm == 'y':
food.cook()
break
elif choice == 8:
Microwave.display1()
print("Microwave telah dibersikan")
elif choice == 99:
Pinlock = int(input("Atur PIN :"))
ChildLock = True
os.system('cls')
elif choice == 0:
print("Terima Kasih telah menggunakan produk kami hehehe")
break
else:
Microwave.display1()
Microwave.menulock()
pin = int(input("Masukan PIN :"))
if pin == Pinlock:
ChildLock = False
os.system('cls')
Microwave.display1()
elif pin == 0:
print("Terima Kasih telah menggunakan produk kami hehehe")
break
else:
os.system('cls')
Microwave.Start()