You are upgrading the ATM system of the previous problem using a new object-orie
ID: 3843669 • Letter: Y
Question
Explanation / Answer
The code is as follows:
#!/usr/bin/python
class SavingAccount:
accountNumber = 1
customerName = ""
balance = 1
def __init__(self, acctNum, acctName, acctBal):
self.accountNumber = acctNum
self.customerName = acctName
self.balance = acctBal
def getBalance(self):
return self.balance
def deposit(self, amt):
self.balance = self.balance + amt
def withdrawl(self, amt):
self.balance = self.balance - amt
ab = SavingAccount(123, "xyz", 100)
print ab.getBalance()
ab.deposit(200)
print ab.getBalance()
ab.withdrawl(100)
print ab.getBalance()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.