Findryan

Untitled

Dec 9th, 2016
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public class BalanceInquiry extends Transaction
  2. {
  3. // BalanceInquiry constructor
  4. public BalanceInquiry(int userAccountNumber, Screen atmScreen, BankDatabase atmBankDatabase){
  5. super(userAccountNumber, atmScreen, atmBankDatabase);
  6. } // end BalanceInquiry constructor
  7.  
  8. // performs the transaction
  9. @Override
  10. public void execute(){
  11. // get references to bank database and screen
  12. BankDatabase bankDatabase = getBankDatabase();
  13. Screen screen = getScreen();
  14.  
  15. // get the available balance for the account involved
  16. double availableBalance = bankDatabase.getAvailableBalance(getAccountNumber());
  17.  
  18. // get the total balance for the account involved
  19. double totalBalance = bankDatabase.getTotalBalance(getAccountNumber());
  20.  
  21. // display the balance information on the screen
  22. screen.displayMessageLine("\nBalance Information : ");
  23. screen.displayMessage(" - Available Balance : ");
  24. screen.displayDollarAmount(availableBalance);
  25. screen.displayMessage("\n - Total Balance : ");
  26. screen.displayDollarAmount(totalBalance);
  27. screen.displayMessageLine("");
  28. } // end method execute
  29. } // end class BalanceInquiry
Add Comment
Please, Sign In to add comment