public class Book
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int[] |
dueDate |
private int |
id |
private java.lang.String |
status |
private java.lang.String |
title |
Constructor and Description |
---|
Book(int id)
Create new Book with given id (Usually used as placeholders)
|
Book(int id,
java.lang.String title,
java.lang.String status,
int[] dueDate)
Create new Book with given id, title, status and dueDate (Usually used for initialization from database)
|
Book(java.lang.String title,
int id,
java.lang.String status)
Create new Book with given title, id and status (Usually used for new Book creation)
|
Modifier and Type | Method and Description |
---|---|
(package private) int[] |
getDueDate()
Returns the due date of the Book
|
int |
getId()
Returns the id of the Book
|
java.lang.String |
getStatus()
Returns the status of the Book
|
java.lang.String |
getTitle()
Returns the title of the Book
|
double |
overdueFine(int[] currentDay)
Calculate the overdue fine
|
(package private) boolean |
rent(int[] dueDate)
Call to rent book, return if renting is successful
|
(package private) void |
returned()
Return the Book to the shelf
|
void |
setTitle(java.lang.String title)
Set the title to the given title
|
private int[] dueDate
private int id
private java.lang.String status
private java.lang.String title
public Book(int id)
id
- Identification number of the Bookpublic Book(int id, java.lang.String title, java.lang.String status, int[] dueDate)
id
- Identification number of the Booktitle
- Title of the Bookstatus
- Status of the BookdueDate
- Due date of the Bookpublic Book(java.lang.String title, int id, java.lang.String status)
title
- Title of the Bookid
- Identification number of the Bookstatus
- Status of the Bookint[] getDueDate()
public int getId()
public java.lang.String getStatus()
public java.lang.String getTitle()
public double overdueFine(int[] currentDay)
currentDay
- Today's dateboolean rent(int[] dueDate)
dueDate
- The new due date of the Bookvoid returned()
public void setTitle(java.lang.String title)
title
- The new title of the Book