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):

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 add_interest () which adds balance (the interest should be the interest rate multiplied by the current balance). (c) Create a subclass of BankAccount called StudentAccount. Every StudentAccount should have an overdraft limit of 1000. Write a constructor for the new class. Override the withdraw () method to make sure that students can withdraw money up to their overdraft limits
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
