diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/__pycache__/bank.cpython-39.pyc b/__pycache__/bank.cpython-39.pyc new file mode 100644 index 0000000..af5896a Binary files /dev/null and b/__pycache__/bank.cpython-39.pyc differ diff --git a/__pycache__/client.cpython-39.pyc b/__pycache__/client.cpython-39.pyc new file mode 100644 index 0000000..52683dc Binary files /dev/null and b/__pycache__/client.cpython-39.pyc differ diff --git a/bank.py b/bank.py new file mode 100644 index 0000000..4fcd0be --- /dev/null +++ b/bank.py @@ -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) diff --git a/client.py b/client.py new file mode 100644 index 0000000..0a539e7 --- /dev/null +++ b/client.py @@ -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) \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..4527b65 --- /dev/null +++ b/main.py @@ -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') + + + diff --git a/uml class diagram.jpg b/uml class diagram.jpg new file mode 100644 index 0000000..34b688c Binary files /dev/null and b/uml class diagram.jpg differ diff --git a/use case diagram.jpg b/use case diagram.jpg new file mode 100644 index 0000000..5e84a0f Binary files /dev/null and b/use case diagram.jpg differ