-
Notifications
You must be signed in to change notification settings - Fork 55.7k
Expand file tree
/
Copy pathOOP's_Project_Bank_Management_System.py
More file actions
72 lines (58 loc) · 1.9 KB
/
OOP's_Project_Bank_Management_System.py
File metadata and controls
72 lines (58 loc) · 1.9 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
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)