Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 =

image text in transcribed

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 2% 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 $5 fee from the account

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

What is an employee assistance program?

Answered: 1 week ago

Question

3. What changes should I be making?

Answered: 1 week ago

Question

2. Why?

Answered: 1 week ago