Advertisement
rmword

Untitled

Oct 23rd, 2017
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 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)
  20. return true;
  21. else
  22. return false;
  23. }
  24.  
  25. public double getAvailableBalance()
  26. {
  27. return availableBalance;
  28. }
  29.  
  30. public double getTotalBalance()
  31. {
  32. return totalBalance;
  33. }
  34.  
  35. public void credit(double amount)
  36. {
  37. totalBalance +=amount;
  38. }
  39.  
  40. public void debit(double amount)
  41. {
  42. availableBalance -=amount;
  43. totalBalance -= amount;
  44. }
  45.  
  46. public int getAccountNumber()
  47. {
  48. return accountNumber;
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement