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):
- balance = float(0);
- def __init__(self):
- self.balance = 500
- def deposit(self, amount):
- if amount < 0:
- return "Invalid deposit amount"
- self.balance += amount
- return self.balance
- def withdraw(self, amount):
- if amount > self.balance:
- return "Cannot withdraw beyond the current account balance"
- if (self.balance-amount) < 500:
- return "Cannot withdraw beyond the minimum account balance"
- if amount < 0:
- return "Invalid withdraw amount"
- self.balance -= amount
- return self.balance
- class CurrentAccount(BankAccount):
- balance = float(0);
- def __init__(self):
- balance = 0;
- def deposit(self, amount):
- if amount < 0:
- return "Invalid deposit amount"
- self.balance += amount
- return self.balance
- def withdraw(self, amount):
- if (self.balance-amount) < 0:
- return "Cannot withdraw beyond the current account balance"
- if amount < 0:
- return "Invalid deposit amount"
- self.balance -= amount
- return self.balance
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement