public class BankDatabase { private Account[] accounts; public BankDatabase() { accounts = new Account[ 2 ]; accounts[ 0 ] = new Account( 12345, 1000.0 ); accounts[ 1 ] = new Account( 98765, 120000.0); } private Account getAccount( int accountNumber ) { for ( Account currentAccount : accounts ) { if ( currentAccount.getAccountNumber() == accountNumber) { return currentAccount; } } return null; } public boolean authenticateUser( int userPIN ) { Account userAccount = getAccount( userPIN ); if ( userAccount != null ) { return userAccount.validatePIN( userPIN ); } else { return false; } } public double getTotalBalance( int userAccountNumber ) { return getAccount( userAccountNumber ).getTotalBalance(); } public void debit(int userAccountNumber, double amount) { getAccount(userAccountNumber).debit(amount); } }