Advertisement
nawamkihafahd

Untitled

Oct 26th, 2017
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. public class Account_Database
  2. {
  3. // instance variables - replace the example below with your own
  4. private Account accounts[];
  5. public Account_Database()
  6. {
  7. accounts = new Account[6];
  8. accounts[0] = new Account(13579,1000000);
  9. accounts[1] = new Account(24680, 400000);
  10. accounts[2] = new Account(16124, 100000);
  11. accounts[3] = new Account(16001, 50000);
  12. accounts[4] = new Account(16002, 10000);
  13. accounts[5] = new Account(10001, 9999);
  14. }
  15. public Account getAccount(int AccountNumber)
  16. {
  17. for(Account currentAccount : accounts)
  18. {
  19. if ( currentAccount.getAccountNumber() == AccountNumber ) return currentAccount;
  20. }
  21. return null;
  22. }
  23. public boolean authenticateUser(int UserAccount)
  24. {
  25. Account userAccount = getAccount(UserAccount);
  26. if(userAccount == null)
  27. return false;
  28. return true;
  29. }
  30. public int getAccountBalance(Account useraccount)
  31. {
  32. return useraccount.getBalance();
  33. }
  34. public void tollpay(Account useraccount, int amount)
  35. {
  36. useraccount.pay(amount);
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement