Need Help, if can provide detail information, thanks. ## Create a class called B
ID: 3533532 • Letter: N
Question
Need Help, if can provide detail information, thanks.
## Create a class called BankAccount. The objects of this class have 4 attributes: account holder name, account ID, PIN (4 digit numeric password) and total money in the account.
## The methods should be: the constructor which initializes account holder name, account ID, total money in the account; a method called deposit which increases the total money by the deposited amount;
## a method called withdraw which decreases the total money by the withdrawn amount and a method called printInformation which prints information about the account
Explanation / Answer
class BankAccount():
def __init__(self,name,id,pin,money):
self.name=name
self.id=id
self.pin=pin
self.money=float(money)
def deposit(self,amount):
self.money=self.money+float(amount)
def widthdraw(self,amount):
self.money=self.money-float(amount)
def printInformation(self):
print "This account is held by "+self.name +" with ID "+self.id+" and pin " + self.pin + "and has a balance of " +str(self.money)+". "
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.