Ramdan51-062

Account

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