# jackzhang **Repository Path**: jackzhangjw/jackzhang ## Basic Information - **Project Name**: jackzhang - **Description**: No description available - **Primary Language**: C++ - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-24 - **Last Updated**: 2025-05-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Jack's Banking System Jack 2023900904 ## Project Overview This project implements a comprehensive banking system that simulates basic banking operations including customer management, account creation, transactions (deposits, withdrawals, transfers), and reporting. The system supports multiple account types and maintains transaction records for reporting. ## Class Overview ### Account (Abstract Base Class) - **Purpose**: Serves as the interface for all bank account types - **Key Features**: - Defines the common interface for all account types with abstract methods for deposit, withdraw, and transfer - Stores basic account information (account ID, balance, customer name) - Manages transaction history for each account ### SavingsAccount (Derived from Account) - **Purpose**: Represents a savings account with specific restrictions - **Key Features**: - Only allows transfers to the same customer's checking account - Does not support direct deposits or withdrawals (as per banking regulations) - Automatically assigns a unique account ID with format 6221-YYYY-ZZZZ-AAAA ### CheckingAccount (Derived from Account) - **Purpose**: Represents a checking account with more flexible operations - **Key Features**: - Supports deposits, withdrawals, and transfers to any account - Only account type that allows direct deposits and withdrawals - Automatically assigns a unique account ID with format 6222-YYYY-ZZZZ-AAAA ### Customer - **Purpose**: Represents a bank customer and manages their accounts - **Key Features**: - Stores customer information - Manages both savings and checking accounts for each customer - Provides methods to access transaction history across all customer accounts - Generates customer-specific transaction reports ### Transaction - **Purpose**: Records details of banking transactions - **Key Features**: - Stores transaction information (type, amount, source, destination, timestamp) - Supports various transaction types (deposit, withdrawal, transfer) - Generates unique transaction IDs - Provides string representation for reporting purposes ### BankSystem - **Purpose**: Central management class for the entire banking system - **Key Features**: - Manages all customers and accounts in the system - Provides account lookup and customer management functionality - Generates unique account IDs - Creates system-wide transaction reports ## Architecture The system follows a layered architecture: 1. **User Interface Layer** (in main.cpp) - Console-based menu system with the following options: - Register new customer - Access customer accounts - Display all bank accounts - Transaction reports - Exit - User input handling - Output formatting 2. **Business Logic Layer** (BankSystem, Customer classes) - Customer management - Account creation and lookup - Report generation 3. **Domain Layer** (Account, SavingsAccount, CheckingAccount, Transaction classes) - Core banking operations - Transaction processing - Data encapsulation ## Key Design Decisions 1. **Abstract Account Class** - Decision: Used an abstract base class for Account to enforce a common interface - Rationale: This approach allows for polymorphic behavior while ensuring all account types implement required functionality 2. **Account Restrictions** - Decision: Implemented specific restrictions for different account types - Rationale: Models real-world banking practices while demonstrating inheritance and polymorphism 3. **Transaction Recording** - Decision: All financial operations create Transaction objects - Rationale: Maintains an audit trail and supports comprehensive reporting 4. **Unique Account IDs** - Decision: Implemented a random generation system with verification - Rationale: Ensures uniqueness while following Chinese banking account number conventions 5. **Smart Pointers** - Decision: Used shared_ptr for memory management - Rationale: Simplifies ownership management and prevents memory leaks 6. **Report Generation** - Decision: Implemented three levels of reporting: - Bank account level: Transactions for a specific account - Customer level: Transactions across all accounts of a customer - Global level: All transactions in the system - Rationale: Provides flexibility in viewing transaction history at different scopes ## Build and Run Instructions 1. Compile all source files: ``` # Linux/Mac g++ -o BankSystem_fix.exe main.cpp Account.cpp BankSystem.cpp CheckingAccount.cpp Customer.cpp SavingsAccount.cpp Transaction.cpp # Windows (PowerShell) g++ -o BankSystem_fix.exe main.cpp Account.cpp BankSystem.cpp CheckingAccount.cpp Customer.cpp SavingsAccount.cpp Transaction.cpp ``` 2. Run the executable: ``` # Linux/Mac ./BankSystem_fix.exe # Windows .\BankSystem_fix.exe ```