forked from fenyx-it-academy/Class7-Python-Module-Week4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankAccount.py
More file actions
35 lines (28 loc) · 909 Bytes
/
BankAccount.py
File metadata and controls
35 lines (28 loc) · 909 Bytes
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
# 3. BankAccount
class BankAccount:
def __init__(self,accountNumber,name,balance):
self.accountNumber = accountNumber
self.name = name
self.balance = balance
def deposit(self,d):
self.balance = d+self.balance
return self.balance
def withdrawal(self,w):
if w <= self.balance:
self.balance = self.balance-w
else:
print("Impossible operation! Insufficient balance!")
return self.balance
def bankFees(self):
self.balance = self.balance - (self.balance*0.05)
return self.balance
def desplay(self):
print(f"Bank Account Details:\nBank account number: {self.accountNumber}\nName: {self.name}\nBalance: {self.balance}")
acc = BankAccount(1234,"shatha",150)
acc.deposit(50)
acc.withdrawal(10)
acc.withdrawal(50)
acc.withdrawal(40)
acc.bankFees()
acc.withdrawal(100)
acc.desplay()