Question: This question tests your understanding of Object-Oriented Programming. The following code defines the start of a class to represent bank accounts: class BankAccount(object): interest_rate =
This question tests your understanding of Object-Oriented Programming. The following code defines the start of a class to represent bank accounts:
class BankAccount(object):
interest_rate = 0.3
def init (self, name, number, balance):
self.name = name self.number = number self.balance = balance return
a)Name the class variables and the instance variables in the given code.
b)Add instance methods called deposit () and withdraw () which increase and decrease the balance of the account. Make sure the withdraw () method doesn't allow the account to go into overdraft. Add a third method called addinterest() which adds interest to the balance (the interest should be the interest rate multiplied by the current balance).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
