Letβs Build a Bank Account Simulation
26 May 2025 at 14:50
Problem Statement
Overview
Build a bank system to create and manage user accounts, simulate deposits, withdrawals, interest accrual, and overdraft penalties.
Goals
- Support multiple account types with different rules
- Simulate real-world banking logic like minimum balance and interest
- Track user actions securely
Suggested Classes
BankAccount
: account_number, owner, balance, deposit(), withdraw()SavingsAccount(BankAccount)
: interest_rate, apply_interest()CheckingAccount(BankAccount)
: minimum_balance, penaltyUser
: name, password, accounts[]
Features
- Create new accounts (checking/savings)
- Deposit money to account
- Withdraw money (with rules):
- Checking: maintain minimum balance or pay penalty
- Savings: limit to 3 withdrawals/month
- Apply interest monthly for savings
- Show account summary
OOP Concepts
- Inheritance:
SavingsAccount
andCheckingAccount
fromBankAccount
- Encapsulation: Balance, account actions hidden inside methods
- Polymorphism: Overridden
withdraw()
method in each subclass
Optional Extensions
- Password protection (simple CLI input masking)
- Transaction history with timestamp
- Monthly bank statement generation