This project demonstrates an advanced Python implementation of a Bank Management System using Object-Oriented Programming (OOP) principles. The system allows users to create different types of bank accounts, deposit and withdraw money, view account details, and apply interest to savings accounts. It illustrates key OOP concepts such as inheritance, polymorphism, encapsulation, and exception handling.
This project simulates a simple bank management system where users can perform operations on different types of accounts: Checking Account and Savings Account. Each account type has specific behaviors, such as adding interest for savings accounts, and adheres to a common interface defined by an abstract base class.
The system is designed to demonstrate core OOP principles in Python, making it an excellent reference for those learning or teaching object-oriented design.
- Abstract Base Class (
BankAccount
): Defines a common interface for all types of bank accounts. - Checking Account (
CheckingAccount
): Allows deposits and withdrawals with basic functionality. - Savings Account (
SavingsAccount
): Supports deposits, withdrawals, and interest calculation. - Polymorphism: Different account types implement the same methods in different ways.
- Encapsulation: The balance is managed internally and is not directly accessible from outside the class.
- Exception Handling: Ensures that all operations are valid and handles errors gracefully.
- Python 3.x
No external packages are required for this project.
-
Clone the Repository:
Clone the repository to your local machine:
git clone https://github.com/your-username/bank-management-system.git
-
Navigate to the Directory:
Go to the project directory:
cd bank-management-system
-
Run the Script:
Run the script using Python:
python bank_management_system.py
When you run the script, it will:
- Create instances of
CheckingAccount
andSavingsAccount
. - Perform various operations (deposit, withdraw, add interest) on these accounts.
- Display account details before and after operations.
Running the script will produce output similar to:
=== Checking Account Details ===
Account Number: CHK12345, Account Holder: John Doe, Balance: 500.00
Deposited $200.00 to Checking Account.
Withdrew $150.00 from Checking Account.
Updated Balance: 550.0
=== Savings Account Details ===
Account Number: SAV67890, Account Holder: Jane Doe, Balance: 1000.00
Deposited $300.00 to Savings Account.
Withdrew $100.00 from Savings Account.
Added interest of $36.00 to Savings Account.
Updated Balance: 1236.0
To add a new type of bank account, you can create a new class that inherits from BankAccount
and implement the required methods (deposit
and withdraw
). For example:
class BusinessAccount(BankAccount):
# Implement deposit and withdraw methods specific to BusinessAccount
pass
Contributions are welcome! If you have ideas for new features, improvements, or bug fixes, please feel free to open an issue or create a pull request.
- Fork the Repository: Click the 'Fork' button at the top right of this page.
- Clone Your Fork: Clone your forked repository to your local machine.
git clone https://github.com/your-username/bank-management-system.git
- Create a Branch: Create a new branch for your feature or bug fix.
git checkout -b feature/your-feature-name
- Make Changes: Make your changes and commit them with a descriptive message.
git commit -m "Add: feature description"
- Push Changes: Push your changes to your forked repository.
git push origin feature/your-feature-name
- Create a Pull Request: Go to the original repository on GitHub and create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
Thank you for using the Bank Management System! If you have any questions or feedback, feel free to reach out. Happy coding! 😊