From 5d9728cc235d8510869da38c6e957aea6a3cd612 Mon Sep 17 00:00:00 2001 From: BinHong Lee Date: Mon, 8 May 2017 00:21:13 -0700 Subject: [PATCH] Added documentations for Book and BookFactory --- docs/index.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 docs/index.md diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..7dfe86b --- /dev/null +++ b/docs/index.md @@ -0,0 +1,42 @@ +# Documentations + +- [Book](#book) +- [Book Factory](#book-factory) + +# Book + +## Constructors + +| Method | Description | +|:-------|:------------| +| Book(int id) | Create a book with a specific id | +| Book(String title, int id) | Create a book with specific id and title | + +## Functions + +| Return | Method | Description | +|:-------|:-------|:------------| +| String | getTitle() | Returns the title of the book | +| String | getStatus() | Returns the status of the book | +| String | getId() | Returns the id of the book | +| void | setTitle() | Set the title of the book | +| boolean | rent(int[] dueDate) | Returns if the rent action is successful and set the due date to the given input | +| void | returned() | Return the book | +| double | overdueFine(int[] currentDay) | Calculate and return the amount of fine to be charged
(Fine rate is 0.25 per day; Max fine is 5) | + +# Book Factory + +## Constructors + +| Method | Description | +|:-------|:------------| +| BookFactory() | Creates an empty BookFactory | + +## Functions + +| Return | Method | Description | +|:-------|:-------|:------------| +| Book | newBook(String title) | Creates a new Book with the given title and returns it | +| Book | getBook(int index) | Returns the book of the given index if it exist, else throw null pointer exception | +| Book | getBook(String title) | Returns the book of the given title if it exist, else throw null pointer exception | +| void | update(Book newbook) | Replaces the existing book of the same id with this new one |