Skip to content
Roshan Arun Kumar
All projects

ATM Simulator

2021

A desktop ATM simulator modelling customers, accounts and transactions as separate classes behind a Swing interface.

  • Java
  • Swing

An introductory coursework project. Included for the modelling, not the scope.

Domain model

BankAccount.java

public class BankAccount {
    private double balance;

    public boolean withdraw(double amount) {
        if (amount <= 0 || amount > balance) return false;
        balance -= amount;
        return true;
    }
}

The account enforces its own invariants, so no caller can push it into an invalid state.

An early coursework project, included because it is where domain modelling stopped being an abstract idea. Customer, BankAccount and Transactions each own their own state and rules, with the Swing GUI kept as a layer on top rather than the place the logic lives.

That separation is the same instinct behind the Sudoku solver on this site — keep the rules independent of whatever is drawing them — arrived at years earlier and much less deliberately.