Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, Please see question below. It is an OOP question in the Python language. I would be grateful for any help with this question. This

Hi, Please see question below. It is an OOP question in the Python language. I would be grateful for any help with this 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 = 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 doesnt allow the account to go into overdraft. Add a third method called add interest() which adds interest to the 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

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago