Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Activity 0 1 : Create a Python class named BankAccount. 1 . Add properties for the account holder's name, account number, and account balance. 2

Activity 01: Create a Python class named "BankAccount."
1. Add properties for the account holder's name, account number, and account balance.
2. Initialize these properties in the class constructor (init).
3. Add a method named "deposit" that allows you to deposit a specified amount of money into the account.
4. Add a method named "withdraw" that allows you to withdraw a specified amount of money from the account. Ensure that the "withdraw" method checks if there is sufficient balance before allowing the withdrawal.
5. Add a method named "get_balance" that returns the current account balance.
6. Add a method named "display_info" that displays the account holder's name, account number, and current balance.
7. Create instances of the BankAccount class and test its methods. Use the deposit, withdraw, get_balance, and display_info methods to perform various transactions and display account information. Verify that the class behaves as expected by testing different scenarios (e.g., insufficient balance, valid transactions, etc.).
8. Add documentation to your class to explain the purpose and usage of each method. Add comments for the class itself and each of its methods to describe what they do and what parameters they accept.
Note: Use the __init__() method to initialize the attribute. (Refer OOP1 slides for more information on how to create instance attributes)
Activity 02: Extend the BankAccount class by adding additional features, such as account type (e.g., savings or checking). Test these new features and document them.
Create a new class named "SavingsAccount" that inherits from the BankAccount class.
Add properties specific to a savings account, such as an interest rate and a method to calculate and apply interest.
Test the SavingsAccount class by creating instances and performing savings account-related transactions. Document these transactions and how the interest is calculated.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions