-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource_code.py
More file actions
90 lines (72 loc) · 2.65 KB
/
source_code.py
File metadata and controls
90 lines (72 loc) · 2.65 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
#-----------------Coffeee Machine Software-------------------------#
##-----[Program Requirements]-------#
#1. print report
#2. check resources if they are sufficient.
#3. process coins.
#4. check transaction successful
#5. make coffee.
#globals
ACTIVE = True;
DORMANT = False;
DRINKS = ["espresso","latte","cappuccino"];
#Imports
from prog_functions import *
from art import *
def run_coffee_software():
machine_status = ACTIVE;
price = read_company_profit();
#UI stuff
print(company_logo);
general_pause('start');
while(machine_status):
print(company_logo);
command = input("\ntype:\n'espresso'\n'latte'\n'cappuccino'\nto make your drink.\n************************\n************************\ntype 'help' for other commands. \n>> ").lower();
if command == "help":
#UI stuff
print(help_art);
printHelp();
general_pause("restart");
loading_animation("restarting Coffee machine ", 1.5);
run_coffee_software();
elif command == "report":
loading_animation('generating report', 1);
generate_report(price);
print()
general_pause('continue');
elif command == "off":
#UI stuff
cts();
loading_animation('shutting down ', 4)
print(company_logo);
loading_animation('',2);
cts();
machine_status = False; #switching off the system.
break;
elif command in DRINKS:
#UI stuff
cts();
loading_animation('generating initial report', 1);
generate_report(price);
general_pause('continue');
print(company_logo);
price = buy_drink(command); #if price == -1, smth went wrong
if price >= 0:
#UI stuff;
loading_animation('heading to payment section', 1)
general_pause('enter payment section');
valid_payment = process_payment(price);
if(valid_payment):
price = read_company_profit();
print(price)
print();
general_pause('generate final report')
loading_animation('generating final report', 1.5);
generate_report(price);
general_pause('continue ')
else:
print("smth went wrong with the payment.")
else:
print("command not recognized!");
run_coffee_software();
pass;
run_coffee_software();