Question: modify code below class BankAccount (): interest_rate = 0.3 def __init__(self, name, number, balance): self.name = name self.num = number self.bal = balance def withdraw(self,

modify code below

modify code below class BankAccount (): interest_rate = 0.3 def __init__(self, name,

class BankAccount (): interest_rate = 0.3

def __init__(self, name, number, balance): self.name = name self.num = number self.bal = balance

def withdraw(self, amount): self.bal = self.bal - amount

def deposit(self, amount): self.bal = self.bal + amount

def add_interest(self): self.bal += self.bal * self.interest_rate

Modify accounts.py to: 1. Put a comment after the instance and class variables to indicate what they are: a. i.e # class variable or #instance variable 2. Change the interest rate to be 5% 3. Modify withdraw() to check if the balance is able to cover the withdrawal amount a. If not, raise an exception (in the withdraw method) with the message "Exception: Withdrawal exceeds balance" and leave the balance unchanged. 4. Create a new method charge_fees() to deduct a $10 fee from the account

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!