| 1 |
import sys |
| 2 |
|
| 3 |
class Account: |
| 4 |
def __init__(self, name, balance): |
| 5 |
self.name = name |
| 6 |
self.balance = balance |
| 7 |
def deposit(self, amt): |
| 8 |
self.balance = self.balance + amt |
| 9 |
def withdrawal(self, amt): |
| 10 |
self.balance = self.balance - amt |
| 11 |
def inquiry(self): |
| 12 |
return self.balance |
| 13 |
|
| 14 |
if __name__ == "__main__": |
| 15 |
acct1 = Account("checking", 0) |
| 16 |
acct2 = Account("savings", 30) |
| 17 |
acct1.deposit(15) |
| 18 |
acct2.withdrawal(2) |
| 19 |
acct1.withdrawal(5) |
| 20 |
acct2.deposit(5) |
| 21 |
print ("Checkings current balance is: %d" % acct1.inquiry()) |
| 22 |
print ("Savings current balance is: %d" % acct2.inquiry()) |
| 23 |
|
| 24 |
sys.exit(0) |