Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CashDispenser
- {
- // instance variables - replace the example below with your own
- private final static int INITIAL_COUNT = 500;
- private int count;
- public CashDispenser()
- {
- count = INITIAL_COUNT;
- }
- public void dispenseCash( int amount )
- {
- int billsRequired = amount / 20;
- count -= billsRequired;
- }
- public boolean isSufficientCashAvailable( int amount )
- {
- int billsRequired = amount / 20;
- if ( count >= billsRequired )
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
Add Comment
Please, Sign In to add comment