Skip to content

A simple C# banking system simulator with account management, deposits, withdrawals, transfers, and transactions rollback support

Notifications You must be signed in to change notification settings

nodogx/Banking-System-Simulator

Repository files navigation

Banking System Simulator (C# Console)

C# console-based banking system that demonstrates Object-Oriented Programming (OOP) through Accounts, Transactions (Deposit, Withdraw, Transfer), and rollback aspects.

Features

  • Create and store accounts in-memory
  • Deposit and Withdraw with validation
  • Transfer between accounts (withdraw + deposit)
  • Transaction state tracking: Executed, Success, Reversed
  • Rollback support for transactions
  • Interactive console menu (text UI)

OOP concepts

  • Encapsulation
    • Account state (Name, Balance) is private and modified only via methods deposit() and withdraw().
  • Composition
    • TranserTransaction composes a WithdrawTransaction and DepositTransaction to perform an atomic transfer.
  • Abstraction (interfaces suggested)
    • Each transaction exposes Execute(), RollBack(), and read-only flags.
    • Future improvement: Introduce a common ITransaction interface or abstract base class to unify transaction handling.
  • Information Hiding & Invariants
    • Balance updates are only allowed via guarded methods that validate amounts and available funds.
  • Error Handling as Part of Design
    • Transactions guard against double execution and invalid rollback attempts with clear exceptions and flags.

How to use

1. Clone the Repository

git clone https://github.com/nodogx/Banking-System-Simulator.git
cd Banking-System-Simulator

### 2. Build the Project
Make sure you have the .NET SDK installed (e.g., .NET 7 or .NET 8):
```bash
dotnet build

3. Run the Application

dotnet run

4. Use the Menu Interface

You’ll see:

1. Withdraw
2. Deposit
3. Print Account
4. Transfer
5. Add Account
6. Quit

Enter the number for your action.

5. Example Session

  • Add an account

    Select option: 5
    Enter account name: Alice
    Enter starting balance: 100
    
  • Deposit funds

    Select option: 2
    Enter account name: Alice
    Enter amount to deposit: 50
    
  • Withdraw funds

    Select option: 1
    Enter account name: Alice
    Enter amount to withdraw: 30
    
  • Transfer funds

    Select option: 4
    Enter source account name: Alice
    Enter destination account name: Bob
    Enter amount to transfer: 20
    
  • Print balance

    Select option: 3
    Enter account name: Alice
    
  • Exit

    Select option: 6
    

About

A simple C# banking system simulator with account management, deposits, withdrawals, transfers, and transactions rollback support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages