Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BankAccount(object):
- def withdraw(self):
- pass
- def deposit(self):
- pass
- class SavingsAccount(BankAccount):
- def __init__(self):
- self.balance = 500
- def deposit(self, amount):
- if (amount <= 0):
- return "Invalid deposit amount"
- else:
- self.balance =self.balance + amount
- return self.balance
- def withdraw(self, amount):
- if ( amount <= 0):
- return "Invalid withdrawal amount"
- elif (amount >= self.balance ):
- return "Cannot withdraw beyond the current account balance"
- elif (self.balance - amount <= 500):
- return "Cannot withdraw beyond the minimum account balance"
- else:
- self.balance = self.balance - amount
- return self.balance
- class CurrentAccount(BankAccount):
- def __init__(self):
- self.balance = 0
- def deposit(self, amount):
- if (amount <= 0):
- return "Invalid deposit amount"
- else:
- self.balance = self.balance + amount
- return self.balance
- def withdraw(self, amount):
- if (amount <= 0):
- return "Invalid withdraw amount"
- elif (amount >= self.balance ):
- return "Cannot withdraw beyond the current account balance"
- else:
- self.balance = self.balance - amount
- return self.balance
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement