Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //BankDatabase.java
- //represents the bank account information database
- public class BankDatabase
- {
- private Account[] accounts; // array of accounts
- //no- argumnet database constructor initializes account
- public BankDatabase()
- {
- accounts = new Account[ 2 ]; // just two accounts for testing
- accounts[ 0 ] = new Account( 12345,54321,1000.0, 1200.0);
- accounts[ 1 ] = new Account( 98765,56789,200.0, 200.0);
- } //end of method BankDatabase constructor
- //retrieve Account object containing specified account number
- private Account getAccount( int accountNumber )
- {
- // loop through accounts searching for matching account number
- for ( Account currentAccount : accounts )
- {
- // return current account if match found
- if ( currentAccount.getAccountNumber() == accountNumber )
- return currentAccount;
- } // end for
- return null; // if no matching account was found, return null
- } // end methot getAccount
- //determine whether user-specified account number and PIN
Add Comment
Please, Sign In to add comment