You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
730 B

  1. /*
  2. * Written by : Bin Hong Lee
  3. * Last edited : 6/4/2016
  4. */
  5. class User
  6. {
  7. private String name;
  8. private int id;
  9. private int limit;
  10. private List<int> books = new ArrayList<int>();
  11. public User(String name, int id, int limit)
  12. {
  13. this.name = name;
  14. this.id = id;
  15. this.limit = limit;
  16. }
  17. public String getName()
  18. {
  19. return name;
  20. }
  21. public void setName()
  22. {
  23. this.name = name;
  24. }
  25. public boolean status()
  26. {
  27. if (books.size() < limit)
  28. {
  29. if (bookStatus)
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. public boolean borrowNewBook(int id)
  37. {
  38. if (status)
  39. {
  40. books.add(id);
  41. return true;
  42. }
  43. else
  44. {
  45. return false;
  46. }
  47. }
  48. }