Advertisement
Ramdan51-062

CashDispenser

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