-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutomatedTellerMachine.txt
More file actions
142 lines (126 loc) · 4.13 KB
/
AutomatedTellerMachine.txt
File metadata and controls
142 lines (126 loc) · 4.13 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
#==============================================================================#
import os
from os import system, name
from time import sleep
def clear():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
from datetime import datetime
# datetime object containing current date and time
now = datetime.now()
# dd/mm/YY H:M:S
timestamp = now.strftime("%d/%m/%Y %H:%M:%S")
#==============================================================================#
moneyBalance = 0
withdrawHistory = []
depositHistory = []
withdrawTimes = []
depositTimes = []
#==============================================================================#
while True:
print("==Welcome to ChingChong's Automated Teller Machine!==")
print("What do you want to do? /n")
print("[1] Withdraw")
print("[2] Deposit")
print("[3] Check Balance")
print("[4] Review ATM History")
print("[5] Exit")
chooseOption = int(input("Please enter your choice: "))
if (chooseOption == 1):
print("="*50)
print("You cho0se to withdraw.")
sleep(2)
print("Preparing ATM..")
print("="*50)
sleep(4)
clear()
print("="*50)
chooseWithdraw = int(input("Please enter the amount of money you choose to withdraw: "))
print("="*50)
withdrawHistory.append(chooseWithdraw)
withdrawTimes.append(timestamp)
if (chooseWithdraw % 100 == 0) == True:
if (moneyBalance > chooseWithdraw) == True:
moneyBalance = moneyBalance - chooseWithdraw
print("="*50)
print("You have succesfully withdrawed", chooseWithdraw)
print("="*50)
else:
print("="*50)
print("Withdraw unsuccessful, Please check your balance.")
print("="*50)
else:
print("="*50)
print("Withdraw unsuccessful, the amount should be in hundreds to continue")
print("="*50)
sleep(4)
clear()
elif (chooseOption == 2):
print("="*50)
print("You choose to Deposit.")
sleep(2)
print("Preparing ATM..")
print("="*50)
sleep(4)
clear()
print("="*50)
chooseDeposit = float(input("Please enter the amount of money you choose to Deposit: "))
print("="*50)
depositHistory.append(chooseDeposit)
depositTimes.append(timestamp)
if (chooseDeposit > 0) == True:
moneyBalance = moneyBalance + chooseDeposit
print("="*50)
print("You have succesfully deposited", chooseDeposit)
print("="*50)
else:
print("="*50)
print("Deposit unsuccessful, the amount should be greater than 0 to continue")
print("="*50)
sleep(4)
clear()
elif (chooseOption == 3):
print("="*50)
print("You choose to check your balance.")
sleep(2)
print("Preparing ATM..")
print("="*50)
sleep(4)
clear()
print("="*50)
print("Your balance is", moneyBalance)
print("="*50)
sleep(5)
clear()
elif (chooseOption == 4):
print("You choose to review your ATM's History.")
sleep(2)
print("="*50)
print("Your deposit history: ")
print(depositHistory)
print(depositTimes)
sleep(2)
print("Your withdraw history: ")
print(withdrawHistory)
print(withdrawTimes)
print("="*50)
sleep(5)
clear()
elif (chooseOption == 5):
print("You choose to exit ChingChong's ATM.")
sleep(2)
print("Shutting down ATM..")
sleep(5)
print("Goodbye!")
sleep(1)
clear()
break
else:
print("Invalid Entry, Try Again!")
sleep(2)
clear()
print(":)")