-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBank-App.py
123 lines (107 loc) · 5.96 KB
/
Bank-App.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
119
120
121
122
123
from os import system as comm
import time
class Customer():
def __init__(self,ID,PASSWORD,NAME):
self.name = NAME
self.id = ID
self.password = PASSWORD
self.Balance = 0
class Bank():
def __init__(self):
self.customers = list()
def OurCustomer(self,ID:str,PASSWORD:str,NAME:str):
self.customers.append(Customer(ID,PASSWORD,NAME))
print("Welcome the MAzE BANK !")
def main():
banka = Bank()
while True:
time.sleep(2)
comm("cls")
print("""
[1] I'm also your Customer
[2] I want to be Customer
""")
choose = input("Choose: ")
if choose == "1":
ids = [i.id for i in banka.customers]
ID = input("ID:")
if ID in ids:
for Customer in banka.customers:
if ID == Customer.id:
print("Welcome {}".format(Customer.name))
password = input("Password:")
if password == Customer.password:
print("Succes Login!")
while True:
time.sleep(2)
comm("cls")
print("""
[1]-Balance
[2]-Send Money (own account)
[3]-Send Money
[4]-Draw Money
[0]-EXIT
""")
choose2 = input("Your transaction-->")
if choose2 == "1":
print("Balance:{}".format(Customer.Balance))
input("Press ENTER to back to MENU")
elif choose2 == "2":
Amount = int(input("Amount:"))
Check = input("Do you approve the {} TL deposit to your own account?:Y/N\n".format(Amount))
if Check == "Y" or Check == "y":
Customer.Balance += Amount
print("Your money has been deposited.")
input("Press ENTER to back to MENU")
elif Check == "N" or Check == "n":
print("The transaction has been canceled.")
input("Press ENTER to back to MENU")
else:
print("ERROR??")
input("Press ENTER to back to MENU")
elif choose2 == "3":
SearchID = input("Customer ID=")
if SearchID in ids:
for othercos in banka.customers:
if SearchID == othercos.id:
print("to {}".format(othercos.name))
Amount = int(input("Amount:"))
if Amount <= Customer.Balance:
Check = input("Do you approve the {} TL deposit to our custome named {}?: Y/N\n".format(Amount,othercos.name))
if Check == "Y" or Check == "y":
othercos.Balance += Amount
Customer.Balance -= Amount
print("The money was successfully transferred.")
input("Press ENTER to back to MENU")
elif Check == "N" or Check == "n":
print("The transaction has been canceled.")
input("Press ENTER to back to MENU")
else:
print("ERROR??")
input("Press ENTER to back to MENU")
else:
print("Your balance is insufficient!")
input("Press ENTER to back to MENU")
else:
print("Customer cannot founded!")
input("Press ENTER to back to MENU")
elif choose2 == "4":
Amount = int(input("Amount"))
if Amount <= Customer.Balance:
Customer.Balance -= Amount
print("Your balance is insufficient!")
input("Press ENTER to back to MENU")
else:
print("Your balance is insufficient!") #burada bir hata var amount küçük olsada burayı bastırıyor!
input("Press ENTER to back to MENU")
elif choose2 == "0":
break
else:
print("Customer cannot founded!")
elif choose == "2":
ID = input("Your ID:")
NAME = input("Your Name:")
PASSWORD = input("Enter passw:")
banka.OurCustomer(ID,PASSWORD,NAME)
if __name__ == "__main__":
main()