forked from wtpc/HOoop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatm_machine.py
More file actions
executable file
·105 lines (80 loc) · 2.87 KB
/
atm_machine.py
File metadata and controls
executable file
·105 lines (80 loc) · 2.87 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
#!/usr/bin/env python3
class ATMMachine(object):
"""
This class is an ATM simulator
"""
def __init__(self):
self.accounts = []
def make_a_withdraw(self, account_number, amount):
"""Withdraw (amount) from (account_number)"""
pass
def make_a_deposit(self, account_number, amount):
"""Deposit (amount) into (account_number)"""
pass
def print_account_balance(self, account_number):
"""Print the Account Balance from (account_number)"""
pass
def make_a_transfer(self, from_account_number, to_account_number, amount):
"""Transfer (amount) from (from_account_number) to (to_account_number)"""
pass
def create_new_account(self, account_number, clients_name, initial_balance):
"""Create a new account that belongs to (clients_name) and has the (initial_balance)"""
new_account = Account(account_number, clients_name, initial_balance)
self.accounts.append(new_account)
class Account(object):
"""This class represents a simple Account"""
def __init__(self, account_number, clients_name, initial_balance = 0.0):
self.account_number = account_number
self.clients_name = clients_name
self.balance = initial_balance
def withdraw(self, amount):
"""Withdraw some money!"""
pass
def deposit(self, amount):
"""Let's receive some money!"""
pass
def check_balance(self):
"""Let's see how rich we are!"""
return self.balance
def transfer_money(self, amount, another_account):
"""Transfer money from this account to the other one"""
pass
def main():
atm = ATMMachine()
"""This is the menu"""
menu_text = """
1 - Create new Account
2 - Make a deposit
3 - Withdraw money
4 - Check your balance
5 - Transfer money
0 - Exit
"""
while True:
print("Welcome to the ATM machine")
print("Choose one of the following options:")
print(menu_text)
selected_option = int(input("Option: "))
print()
if selected_option == 1:
print("Register new Account:")
account_number = int(input("Number: "))
clients_name = input("Name: ")
initial_balance = float(input("Initial Balance: "))
atm.create_new_account(account_number, clients_name, initial_balance)
elif selected_option == 2:
print("Make a deposit:")
elif selected_option == 3:
print("Withdraw money:")
elif selected_option == 4:
print("Check your balance:")
elif selected_option == 5:
print("Transfer money:")
elif selected_option == 0:
print("Bye Bye!")
exit(0)
else:
print("Invalid option!")
print()
if __name__ == '__main__':
main()