Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Account_Database
- {
- // instance variables - replace the example below with your own
- private Account accounts[];
- public Account_Database()
- {
- accounts = new Account[6];
- accounts[0] = new Account(13579,1000000);
- accounts[1] = new Account(24680, 400000);
- accounts[2] = new Account(16124, 100000);
- accounts[3] = new Account(16001, 50000);
- accounts[4] = new Account(16002, 10000);
- accounts[5] = new Account(10001, 9999);
- }
- public Account getAccount(int AccountNumber)
- {
- for(Account currentAccount : accounts)
- {
- if ( currentAccount.getAccountNumber() == AccountNumber ) return currentAccount;
- }
- return null;
- }
- public boolean authenticateUser(int UserAccount)
- {
- Account userAccount = getAccount(UserAccount);
- if(userAccount == null)
- return false;
- return true;
- }
- public int getAccountBalance(Account useraccount)
- {
- return useraccount.getBalance();
- }
- public void tollpay(Account useraccount, int amount)
- {
- useraccount.pay(amount);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement