Package my.edu.tarc.dco.bookrentalpos
Class Book
java.lang.Object
my.edu.tarc.dco.bookrentalpos.Entity
my.edu.tarc.dco.bookrentalpos.Book
public class Book extends Entity
Class used to store Book data for POS system
- Version:
- 1.0
- Author:
- Looz
-
Constructor Summary
Constructors Constructor Description Book()BlankBook(int id, String date, String name, String author, double retailPrice, Member lastRentedBy, Member lastReservedBy, boolean isRented, boolean isReserved)Constructor used to import Book data from DatabaseBook(String name, String author, double retailPrice)Constructor used to create a new Book entry -
Method Summary
Modifier and Type Method Description StringgetAuthor()MembergetLastRentedBy()MembergetLastReservedBy()StringgetRentedText()FXML useStringgetReservedText()FXML usedoublegetRetailPrice()BooleanisRented()Check whether the book is currently rentedBooleanisReserved()Check whether the book is currently reserved.voidsetAuthor(String author)voidsetLastRentedBy(Member lastRentedBy)voidsetLastReservedBy(Member lastReservedBy)voidsetRented(boolean rentState)voidsetRentedText(String rentedText)FXML usevoidsetReserved(boolean reserveState)voidsetReservedText(String reservedText)FXML usevoidsetRetailPrice(double retailPrice)StringtoString()Methods inherited from class my.edu.tarc.dco.bookrentalpos.Entity
equals, getDateCreated, getId, getName, setDateCreated, setID, setName
-
Constructor Details
-
Book
public Book()Blank -
Book
Constructor used to create a new Book entry- Parameters:
name- Book Titleauthor- Book AuthorretailPrice- Book's rental price per day
-
Book
public Book(int id, String date, String name, String author, double retailPrice, Member lastRentedBy, Member lastReservedBy, boolean isRented, boolean isReserved)Constructor used to import Book data from Database- Parameters:
id- Book IDdate- Date the book was added into databasename- Book Titleauthor- Book AuthorretailPrice- Book's rental price per daylastRentedBy- Member object of whoever last rented the booklastReservedBy- Member object of whoever last reserved the bookisRented- Although int is used in database, it is stored as boolean in the systemisReserved- Although int is used in database, it is stored as boolean in the system- See Also:
Book(String, String, double)
-
-
Method Details
-
toString
-
getLastRentedBy
- Returns:
- MemberID of whoever last rented this book. Can be 0 if the member was previously removed
-
setLastRentedBy
- Parameters:
lastRentedBy- MemberID of the person rented this book
-
getLastReservedBy
- Returns:
- Member object of whoever reserved this book
-
setLastReservedBy
- Parameters:
lastReservedBy- MemberID of the person who reserved this book
-
getAuthor
- Returns:
- Author of the book
-
setAuthor
- Parameters:
author- Author of the book in String
-
setRented
public void setRented(boolean rentState)- Parameters:
rentState- boolean to show if the book is currently rented
-
isRented
Check whether the book is currently rented- Returns:
- True if book is currently rented
-
setReserved
public void setReserved(boolean reserveState)- Parameters:
reserveState- boolean to show if the book is currently reserved
-
isReserved
Check whether the book is currently reserved. NOTE: Reserved book cant be rented by the other member other than the one rented it- Returns:
- True if book is currently reserved
-
setRetailPrice
public void setRetailPrice(double retailPrice)- Parameters:
retailPrice- Rental price of the book (per day)
-
getRetailPrice
public double getRetailPrice()- Returns:
- rental Price of the book (per day)
-
getRentedText
FXML use- Returns:
- Rented status of the book, but in text
-
setRentedText
FXML use- Parameters:
rentedText- rented status of the book, but in text
-
getReservedText
FXML use- Returns:
- Reserved status of the book, but in text
-
setReservedText
FXML use- Parameters:
reservedText- reserved status of the book, but in text
-