document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  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, double theAvailableBalance, double theTotalBalance)
  9.     {
  10.         accountNumber = theAccountNumber;
  11.         pin = thePIN;
  12.         availableBalance = theAvailableBalance;
  13.         totalBalance = theTotalBalance;
  14.     }  
  15.    
  16.     public boolean validatePIN(int userPIN)
  17.     {
  18.         if(userPIN == pin)
  19.         {
  20.             return true;
  21.         }
  22.         else
  23.         {
  24.             return false;
  25.         }
  26.     }  
  27.    
  28.     public double getAvailableBalance()
  29.     {
  30.         return availableBalance;
  31.     }
  32.    
  33.     public double getTotalBalance()
  34.     {
  35.         return totalBalance;
  36.     }
  37.    
  38.     public void credit(double amount)
  39.     {
  40.         availableBalance += amount; //anggap deposit yg dimasukkan sudah tervalidasi, maka saldo yg tersedia jg bertambah lgsung
  41.         totalBalance += amount;
  42.     }
  43.    
  44.     public void debit(double amount)
  45.     {
  46.         availableBalance -= amount;
  47.         totalBalance -= amount;
  48.     }
  49.    
  50.     public int getAccountNumber()
  51.     {
  52.         return accountNumber;
  53.     }  
  54. }
');