Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. protected ArrayList<Integer> wishFood = new ArrayList<Integer>();
  2. protected int tryCount = 0;
  3.  
  4. public int getTry() { return tryCount; }
  5.  
  6. public String getWish() {
  7. return Arrays.toString(wishFood.toArray());
  8. }
  9.  
  10. public boolean checkWish(int food) {
  11. this.tryCount += 1;
  12. return wishFood.contains(food);
  13. }
  14.  
  15. public void takeWish(int food) {
  16. int index = wishFood.indexOf(food);
  17. if (index != -1)
  18. wishFood.remove(index);
  19. }
  20.  
  21. public void addWish(int food) {
  22. wishFood.add(food);
  23. }
  24.  
  25. public boolean isDone() {
  26. return wishFood.isEmpty();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement