Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Documentations
  2. | Table of Content |
  3. | :--------------- |
  4. | [Main](#main) |
  5. | [Book](#book) |
  6. | [Book Factory](#book-factory) |
  7. | [User](#user) |
  8. | [User Factory](#user-factory)|
  9. # Main
  10. ## Functions
  11. | Return | Method | Description |
  12. |:-------|:-------|:------------|
  13. | boolean | borrowBook(User user, Book book) | Return if the borrow of the book on both `BookFactory` and `UserFactory` is successful
  14. | boolean | returnBook(User user, Book book) | Return if the return of the book on both `BookFactory` and `UserFactory` is successful
  15. | int[] | calDueDate(int days) | Calculate the due date from the current date according to user's permission
  16. | int[] | currentDay() | Returns the current date in an array form |
  17. # Book
  18. ## Constructors
  19. | Method | Description |
  20. |:-------|:------------|
  21. | Book(int id) | Create a book with a specific id |
  22. | Book(String title, int id) | Create a book with specific id and title |
  23. ## Functions
  24. | Return | Method | Description |
  25. |:-------|:-------|:------------|
  26. | String | getTitle() | Returns the title of the book |
  27. | String | getStatus() | Returns the status of the book |
  28. | String | getId() | Returns the id of the book |
  29. | void | setTitle() | Set the title of the book |
  30. | boolean | rent(int[] dueDate) | Returns if the rent action is successful and set the due date to the given input |
  31. | void | returned() | Return the book |
  32. | double | overdueFine(int[] currentDay) | Calculate and return the amount of fine to be charged<br>(Fine rate is 0.25 per day; Max fine is 5) |
  33. # Book Factory
  34. ## Constructors
  35. | Method | Description |
  36. |:-------|:------------|
  37. | BookFactory() | Creates an empty BookFactory |
  38. ## Functions
  39. | Return | Method | Description |
  40. |:-------|:-------|:------------|
  41. | Book | newBook(String title) | Creates a new Book with the given title and returns it |
  42. | Book | getBook(int index) | Returns the book of the given index if it exist, else throw null pointer exception |
  43. | Book | getBook(String title) | Returns the book of the given title if it exist, else throw null pointer exception |
  44. | void | update(Book newbook) | Replaces the existing book of the same id with this new one |
  45. # User
  46. ## Constructors
  47. | Method | Description |
  48. |:-------|:------------|
  49. | User(String name, int id, int limit) | Create a new User with given name, id and limit |
  50. ## Functions
  51. | Return | Method | Description |
  52. |:-------|:-------|:------------|
  53. | String | getName() | Returns the name of the user |
  54. | int | getId() | Returns id of the user |
  55. | void | setName() | Set the name of the user |
  56. | boolean | status() | Check if the user reached the limit of amount of books the user can borrow |
  57. | List<Integer> | bookStatus() | Return a list consisting of book ids for all the books rented by the user |
  58. | boolean | borrowNewBook(int id) | Check if the user status if true then add the id to the list of the books borrowed by the user |
  59. | boolean | returnBook(int id) | Check if the book is borrowed by the user then remove it from the list |
  60. # User Factory
  61. ## Constructors
  62. | Method | Description |
  63. |:-------|:------------|
  64. | UserFactory() | Creates a new empty factory |
  65. ## Functions
  66. | Return | Method | Description |
  67. |:-------|:-------|:------------|
  68. | User | newUser(String name, int limit) | Creates a new user and returns the created user |
  69. | User | getUser(String name) | Gets the user with the given name from the factory |
  70. | User | getUser(int index) | Gets the user with the given id from the factory |
  71. | void | update(User oldUser, User newUser) | Update by replacing the existing user with the new one |