Question: In this assignment, we will work with classes and inheritance in python, and do some simple testing on our class to ensure correctness of our

 In this assignment, we will work with classes and inheritance in

In this assignment, we will work with classes and inheritance in python, and do some simple testing on our class to ensure correctness of our methods. Your job is to create three classes 1. BankAccount 2. ChequingAccount 3. SavingsAccount BankAccount must be an abstract base dass see section 2.4.3 of LECTURE_02_NOTES) ChequingAccount and SavingsAccount must both inherit from BankAccount (see section 2.4.1 of LECTURE_02_NOTES). BankAccount must be constructed with 3 arguments to _init_which are: 1. Name of the person who owns the bank account (string) 2. Name of the bank (string) 3. Initial balance (float) BankAccount must implement the following methods 1 deposit (amount) -adds amount to balance 2. withdraw camount) - attempts to subtract amount from balance 1. Returns True if balance - amount > 0, and False otherwise Chequingaccount, which inherits from BankAccount, must take an additional argument to _init_which is transaction fee. ChequingAccount must also implement the method make purchase (amount) which will call the withdraw function of the super dass, and apply transaction fee after withdraw returns. Savingsaccount, which also inherits from BankAccount, must take an additional argument to _init_which is interest rate (afloat between and 0.025). SavingsAccount must implement the method accrue interest which will calculate the interest on balance and increase balance by the amount interest rate balance Tests: In_main_Isee testing the class' in section 2.3 of LECTURE_02_NOTES) provide method coverage and statement coverage for your Chequingaccount and Savingsaccount dasses. Method coverage means your tests should call every method of the class at least once, and statement coverage means your tests should result in the execution of every statement in the class at least once (so method coverage is actually a subset of statement coverage) Operator overloading In table 2.1 of LECTURE_02_NOTES, overloaded operations are shown along with Python's corresponding special methods. Implement thes, and operators for your BankAccount class by defining the corresponding method for example, the corresponding method totis _add_. The operator overloading methods should have the following behavior: + and should add to or subtract from the bank account's balance

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!