Skip to content

Create OOP's_Project_Bank_Management_System.py #1015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
72 changes: 72 additions & 0 deletions OOP's_Project_Bank_Management_System.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
class BankAccount:
def __init__(self, initialAmount, acctName):
self.balance = initialAmount
self.name = acctName

print(f"\nAccount '{self.name}' created. \nBalance = ${self.balance:.2f}")

def getBalance(self):
print(f"\n Account '{self.name}' balance = ${self.balance:.2f}")

def deposit(self, amount):
self.balance = self.balance + amount
print("\n Deposit Complete.")
self.getBalance()

def variableTransaction(self, amount):
if self.balance >= amount:
return
else:
print(f"\n Sorry account '{self.name}' only has a balance of ${self.balance:.2f}")

def withdraw(self, amount):
try:
self.variableTransaction(amount)
self.balance = self.balance - amount
print("\nWidhdraw Complete.")
self.getBalance()
except:
print(f'\nWidhdraw Interrupted:')

def transfer(self, amount, account):
try:
print(f'\n*******\n\nBegging Transfer..rocker')
self.variableTransaction(amount)
self.withdraw(amount)
account.deposit(amount)
print('\n Transfer Complete!')
except:
print(f'\nWidhdraw Interrupted:')

class InterestRewardsAcct(BankAccount):
def deposite(self, amount):
self.balance = self.balance + (amount * 1.05)
print(f'\nDeposite Compete.')
self.getBalance()

class SavingAcct(InterestRewardsAcct):
def __init__(self, initialAmount, acctName):
super().__init__(initialAmount, acctName)
self.fee = 5

def withdraw(self, amount):
try:
self.variableTransaction(amount + self.fee)
self.balance = self.balance - (amount + self.fee)
print("\nWithdraw completed.")
self.getBalance()
except:
print(f'\nWidhdraw Interrupted:')


Mustafa = BankAccount(1000, "Mustafa")
Raza = BankAccount(5000, "Raza")

Mustafa.getBalance()
Raza.getBalance()

Mustafa.deposite(500)
Raza.deposit(1000)

Raza.transfer(1000, Mustafa)
Raza.transfer(10, Mustafa)