# tom1 **Repository Path**: xtab1788/tom1 ## Basic Information - **Project Name**: tom1 - **Description**: No description available - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **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 # tom1 Chianese name:徐曈 id : 2023901699 english name:Tom1 Overview A C++ banking system simulating core functionalities: customer management, account transactions, and report generation. The system supports two account types (Savings & Checking) with specific rules, tracks transactions, and provides a menu-driven interface. Class Overview 1. IAccount (Interface) Purpose: Abstract interface for bank accounts. Key Methods: transfer(): Transfer funds between accounts. getBalance(), getTransactions(), etc.: Access account details. 2. Account (Base Class) Inherits: IAccount. Attributes: accountId, ownerName, balance, transactions (vector of Transaction). Key Functionality: Implements core methods for balance updates and transaction logging. Generates account IDs in the format 62XX-YYYY-ZZZZ-AAAA (Savings: 6221-..., Checking: 6222-...). 3. SavingsAccount Inherits: Account. Restriction: Transfers only allowed to the same owner’s CheckingAccount. 4. CheckingAccount Inherits: Account. Features: Supports deposit() and withdraw() with "CASH" as the counterparty. 5. Transaction Attributes: transactionId, source/destinationAccountId, amount, type (e.g., "TRANSFER"), timestamp. ID Generation: Auto-incremented TXXX format (e.g., T001). 6. BankSystem Core Manager: customers: Maps customer names to their Savings/Checking account pairs. accountsById: Maps account IDs to accounts for quick lookup. Functionality: Customer registration, account retrieval, and report generation (generateTransactionReport(), etc.). 7. main.cpp UI Layer: Menu-driven interface for user interactions (registration, account access, reports). Architecture Layers Data Layer: Account, Transaction (encapsulate data and basic operations). Logic Layer: BankSystem (manages accounts and business rules). UI Layer: main.cpp (handles user input/output). Key Relationships Inheritance: IAccount → Account → SavingsAccount/CheckingAccount. Composition: BankSystem aggregates Account objects. Account aggregates Transaction objects. Key Design Decisions Interface (IAccount) Enables polymorphism for unified handling of SavingsAccount and CheckingAccount. Transaction Handling Each transaction is added to both source and destination accounts (e.g., transfers). deposit()/withdraw() in CheckingAccount use "CASH" as a virtual counterparty. Account ID Generation Structured format (62XX-...) ensures uniqueness and encodes account type. Transfer Restrictions in SavingsAccount Transfers limited to the same owner’s CheckingAccount to enforce savings goals. Memory Management shared_ptr in BankSystem ensures automatic cleanup and safe access. Report Generation Iterates through accountsById to collect all transactions for global reports. Usage Flow Register Customer: Creates linked Savings/Checking accounts. Account Operations: Checking: Deposit, withdraw, transfer. Savings: Transfer to same-owner Checking. Reports: Generate transaction/customer/account details to files.