Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added __init__.py
Empty file.
Binary file added __pycache__/bank.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/client.cpython-39.pyc
Binary file not shown.
19 changes: 19 additions & 0 deletions bank.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

class Bank:
clients = []

def __init__(self,name):
self.name = name

def add_client(self,client):
self.clients.append(client)

def authentication(self,name,account_number):
for i in range(len(self.clients)):
if name == self.clients[i]['name']and account_number == self.clients[i]['account number']:
print("Authentication is successful!")
return self.clients[i]

# c = Bank('Halit')
# c.add_client()
# print(c.clients)
29 changes: 29 additions & 0 deletions client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import random
class Client:
i=0

def __init__(self,name,total_amount,account_number = random.randint(10000,99999)):
self.name = name
self.account_number = account_number
self.total_amount = total_amount
Client.i+=1

def withdraw(self):
amount = int(input('Enter an amount:'))
if amount<= self.total_amount and amount>0:
return f"You have withdrawn {amount}"
else:
return f"Invalid request"

def deposit(self):
amount = int(input('Enter an amount:'))
if amount >0:
return f"You have {self.total_amount + amount} in your account."
else:
return f"You havent deposited any money."

def balance(self):
return f"Your balance is: {self.total_amount}"

# client_1 =Client('halit',10000)
# print(client_1)
47 changes: 47 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from bank import Bank
from client import Client
class Main(Bank):
b=Bank('Rabobank')
while True:
print('Welcome to {}','\n','\n','Choose an option:','\n','1.Open a new bank account','\n','2.Open an existing bank account','\n','3.Exit'.format(b))
number = int(input('Choose an option:'))
if number== 3:
break
elif number == 1:
print('To create an account please fill in the information below')
name= input('Enter your name:')
total_amount = int(input('Enter a deposit amount:'))
client_1= Client(name,total_amount)
b.add_client(client_1)
print('Account created successfully!Your account number is:{}'.format(client_1.account_number))
#print('Choose an option:','\n','1.Open a new bank account','\n','2.Open an existing bank account','\n','3.Exit')
elif number == 2:
print('To access your account, please enter your credentials below','\n')
name = input('Enter your name:')
account_number = int(input('Enter your account number:'))
c_authentication= b.authentication(name,account_number)
if c_authentication:
print('Welcome{}',format(client_1.name))
for i in range(len(b.clients)):
if b.clients[i]['account_number']== account_number:
break
while True:
print("""Choose an option:
1.Withdraw
2.Deposit
3.Balance
4.Exit""")
number1=input('Enter a number:')
if number == 1:
client_1.withdraw()
elif number == 2:
client_1.deposit()
elif number == 3:
client_1.balance()
else:
break
else:
print('Authentication failed!','\n','Reason: account is not found')



Binary file added uml class diagram.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added use case diagram.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.