Free

Banking System (Console)

Never store money in a double — and the program proves it while you watch.

  • Java
  • BigDecimal

About this project

A console banking system: open accounts, deposit, withdraw, transfer, print a statement, credit interest and audit the books. Plain Java — `javac *.java` and `java Bank`, with no build tool, no library and no database.

The idea it is built around is that money is never a double. 0.1 + 0.2 is not 0.3 in Java any more than anywhere else, and menu option 9 computes the whole argument live: ten deposits of ten paise leaving 0.9999999999999999, a customer refused their last ten paise because the balance is really 0.09999999999999998, and four standard-library ways of rounding one charge of Rs 1.005 that do not agree with each other. Every figure on that screen is computed as the program runs, so none of it can quietly go stale.

The second theme is encapsulation as a safety property. The balance is private and changes only through methods that enforce the rules, so no code path can set an account negative. A transfer either completes on both sides or happens on neither, and the audit checks every balance against its own ledger — the property a bank would actually care about.

What you will learn

  • Use BigDecimal with an explicit scale and rounding mode for money, and know why double fails
  • Treat encapsulation as a safety property rather than ceremony
  • Keep a transfer atomic, so it can never debit one account without crediting the other
  • Reconcile a balance against its own ledger, which is what an audit actually is
  • Model refusals as exceptions carrying enough detail to explain themselves

Before you start

  • Java basics — classes, methods and exceptions
  • JDK 17 or newer. No build tool, no library, no database.

New to Java? The free Java course covers everything this project assumes.

Academic integrity notice

These projects are provided for learning, experimentation and reference. Understand the code, modify it for your own requirements, and acknowledge external work according to your institution’s academic policies. Priodemy does not supply work to be submitted as your own.