Findryan

FP_itemDispenser_VM

Dec 25th, 2016
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public class ItemDispenser
  2. {
  3. private final static int [] stock = {2, 2, 1};
  4. private int [] count;
  5.  
  6. public ItemDispenser()
  7. {
  8. count = stock;
  9. }
  10.  
  11. public void dispenseItem(int pilihan)
  12. {
  13. count[pilihan] -= 1;
  14. }
  15.  
  16. public boolean isStockAvailable(int pilihan)
  17. {
  18. if(count[pilihan] > 0)
  19. return true;
  20. else
  21. return false;
  22. }
  23. }
Add Comment
Please, Sign In to add comment