-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank.py
34 lines (24 loc) · 966 Bytes
/
bank.py
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
class Account:
def __init__(self, name, balance, min_balance):
self.name = name
self.balance = balance
self.min_balance = min_balance
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
if self.balance - amount >= self.min_balance:
self.balance -= amount
else:
print("Sorry, not enough funds!")
def statement(self):
print("Account Balance: £{}".format(self.balance))
class Current(Account):
def __init__(self, name, balance):
super().__init__(name, balance, min_balance = -1000 )
def __str__(self):
return "{}'s Current Account : Balance £{}".format(self.name, self.balance)
class Savings(Account):
def __init__(self, name, balance):
super().__init__(name, balance, min_balance = 0)
def __str__(self):
return "{}'s Savings Account : Balance £{}".format(self.name, self.balance)