nawamkihafahd

Untitled

Oct 19th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. public class CashDispenser
  2. {
  3. // instance variables - replace the example below with your own
  4. private final static int INITIAL_COUNT = 500;
  5. private int count;
  6.  
  7. public CashDispenser()
  8. {
  9. count = INITIAL_COUNT;
  10. }
  11.  
  12. public void dispenseCash( int amount )
  13. {
  14. int billsRequired = amount / 20;
  15. count -= billsRequired;
  16.  
  17. }
  18.  
  19. public boolean isSufficientCashAvailable( int amount )
  20. {
  21. int billsRequired = amount / 20;
  22.  
  23. if ( count >= billsRequired )
  24. {
  25. return true;
  26. }
  27. else
  28. {
  29. return false;
  30. }
  31. }
  32. }
Add Comment
Please, Sign In to add comment