farizmpr

Untitled

Oct 19th, 2017
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. public class CashDispenser
  2. {
  3.     private final static int INITIAL_COUNT=500;
  4.     private int count;
  5.    
  6.     public CashDispenser()
  7.     {
  8.         count=INITIAL_COUNT;
  9.     }
  10.    
  11.     public void dispenseCash(int amount)
  12.     {
  13.         int billsRequired=amount/20;
  14.         count -=billsRequired;
  15.     }
  16.    
  17.     public boolean isSufficientCashAvailable(int amount)
  18.     {
  19.         int billsRequired=amount/20;
  20.         if(count>=billsRequired)
  21.             return true;
  22.         else
  23.             return false;
  24.     }
  25. }
Add Comment
Please, Sign In to add comment