farizmpr

Untitled

Oct 19th, 2017
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 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,double 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)
  18.             return true;
  19.         else
  20.             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. }
Add Comment
Please, Sign In to add comment