Browse Source

Added documentations for Book and BookFactory

master
BinHong Lee 7 years ago
parent
commit
5d9728cc23
1 changed files with 42 additions and 0 deletions
  1. +42
    -0
      docs/index.md

+ 42
- 0
docs/index.md View File

@@ -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<br>(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 |

Loading…
Cancel
Save