document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // Account.java
  2. // Represents a bank account
  3. public class Account
  4. {
  5. private int accountNumber; // account number
  6. private int pin; // PIN for authentication
  7. private double availableBalance; // funds available for withdrawal
  8. private double totalBalance; // funds available + pending deposits
  9. // Account constructor initializes attributes
  10. public Account( int theAccountNumber, int thePIN,
  11. double theAvailableBalance, double theTotalBalance )
  12. {
  13. accountNumber = theAccountNumber;
  14. pin = thePIN;
  15. availableBalance = theAvailableBalance;
  16. totalBalance = theTotalBalance;
  17. } // end Account constructor
  18. // determines whether a user-specified PIN matches PIN in Account
  19. public boolean validatePIN( int userPIN )
  20. {
  21. if ( userPIN == pin )
  22. return true;
  23. else
  24. return false;
  25. } // end method validatePIN
  26.  
  27. // returns available balance
  28. public double getAvailableBalance()
  29. {
  30. return availableBalance;
  31. }// end getAvailableBalance
  32. // returns the total balance
  33. public double getTotalBalance()
  34. {
  35. return totalBalance;
  36. } // end method getTotalBalance
  37. // credits an amount to the account
  38. public void credit( double amount )
  39. {
  40. totalBalance += amount; // add to total balance
  41. } // end method credit
  42. // debits an amount from the account
  43. public void debit( double amount )
  44. {
  45. availableBalance -= amount; // subtract from available balance
  46. totalBalance -= amount; // subtract from total balance
  47. } // end method debit
  48. // returns account number
  49. public int getAccountNumber()
  50. {
  51. return accountNumber;
  52. } // end method getAccountNumber
  53. } // end class Account�
');