Help us measure site usage?

With your permission, we use self-hosted analytics to understand page usage. It is optional and does not affect the Service. Learn more.

JavabeginnercliAI generated

Personal Banking Account Simulator

Build a banking simulator in Java that runs in the terminal. You can open savings and checking accounts, deposit and withdraw money, transfer between accounts, and see each account's transaction history. The two account types follow different rules: a checking account allows a small overdraft, while a savings account can't go below zero but earns interest. Invalid operations, like withdrawing more than allowed or using an account that doesn't exist, are refused with a clear message. It's a good first project for object-oriented programming: you'll learn classes and encapsulation, inheritance and abstract classes, custom exceptions, collections such as Map and List, and why money should use BigDecimal.

Estimate
~9h
Steps
6
Completed by
0
Proposed by
codeseed.app

Java OOP · Exceptions

Project roadmap

  1. 01

    Design the account classes

    ~1.5h

    Create an abstract Account class with a private account number, owner name and balance (as BigDecimal, never double), a getter for the balance but no setter, and abstract methods for the withdrawal rule. Create SavingsAccount (can't go below 0, has an interest rate) and CheckingAccount (can go down to an overdraft limit, for example -500). Done when: both account types can be created, and the balance can only change through methods.

  2. 02

    Deposit and withdraw

    ~1.5h

    Add deposit and withdraw methods. Both refuse amounts of 0 or less with an IllegalArgumentException. Withdraw checks the account type's rule and throws your own checked InsufficientFundsException with the available amount when it's broken. Round amounts to 2 decimals. Done when: withdrawing too much from each account type throws the right exception with a helpful message.

  3. 03

    Add a Bank class

    ~1.5h

    Create a Bank class that stores accounts in a Map by account number, generates unique account numbers, and finds accounts (throwing AccountNotFoundException for unknown numbers). Add a transfer method that withdraws from one account and deposits into the other, and leaves both unchanged when the withdrawal fails. Refuse transfers to the same account. Done when: a failed transfer leaves both balances exactly as they were.

  4. 04

    Record transaction history

    ~1.5h

    Create a Transaction class (type, amount, date and time, balance after, and a description such as the other account in a transfer). Every successful operation adds one to the account's history; failed ones add nothing. Add a method on savings accounts that applies monthly interest as a transaction. Done when: an account's history shows every successful operation in order with the running balance.

  5. 05

    Build the console menu

    ~1.5h

    Write a menu loop with Scanner: open an account, deposit, withdraw, transfer, show balance, show history, apply interest, list accounts and exit. Catch exceptions and show their messages without closing the program, and re-ask when the input isn't a valid number. Done when: every menu option works, and invalid input never crashes the program.

  6. 06

    Write tests

    ~1.5h

    Add JUnit 5 and write tests: deposits and withdrawals, the overdraft limit on checking, savings can't go negative, failed transfers change nothing, interest calculation, and history entries. Done when: all tests pass.

Ready to build this?

Get a GitHub repo and start building. Your AI reviewer checks each step as you go.

~9h · 6 steps

Tech stack

Java OOPExceptions