nawamkihafahd

Untitled

Oct 19th, 2017
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. public class Account
  2. {
  3. private int accountNumber;
  4. private int pin;
  5. private double availableBalance;
  6. private double totalBalance;
  7.  
  8. public Account( int theAccountNumber, int thePIN,
  9. double theAvailableBalance, double theTotalBalance )
  10. {
  11. accountNumber = theAccountNumber;
  12. pin = thePIN;
  13. availableBalance = theAvailableBalance;
  14. totalBalance = theTotalBalance;
  15. }
  16.  
  17. public boolean validatePIN( int userPIN )
  18. {
  19. if ( userPIN == pin ) return true;
  20. else return false;
  21. }
  22.  
  23. public double getAvailableBalance()
  24. {
  25. return availableBalance;
  26. }
  27.  
  28. public double getTotalBalance()
  29. {
  30. return totalBalance;
  31. }
  32.  
  33. public void credit( double amount )
  34. {
  35. totalBalance += amount;
  36. }
  37.  
  38. public void debit( double amount )
  39. {
  40. availableBalance -= amount;
  41. totalBalance -= amount;
  42. }
  43.  
  44. public int getAccountNumber()
  45. {
  46. return accountNumber;
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment