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 Details

    • Book

      public Book()
      Blank
    • Book

      public Book​(String name, String author, double retailPrice)
      Constructor used to create a new Book entry
      Parameters:
      name - Book Title
      author - Book Author
      retailPrice - 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 ID
      date - Date the book was added into database
      name - Book Title
      author - Book Author
      retailPrice - Book's rental price per day
      lastRentedBy - Member object of whoever last rented the book
      lastReservedBy - Member object of whoever last reserved the book
      isRented - Although int is used in database, it is stored as boolean in the system
      isReserved - Although int is used in database, it is stored as boolean in the system
      See Also:
      Book(String, String, double)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLastRentedBy

      public Member getLastRentedBy()
      Returns:
      MemberID of whoever last rented this book. Can be 0 if the member was previously removed
    • setLastRentedBy

      public void setLastRentedBy​(Member lastRentedBy)
      Parameters:
      lastRentedBy - MemberID of the person rented this book
    • getLastReservedBy

      public Member getLastReservedBy()
      Returns:
      Member object of whoever reserved this book
    • setLastReservedBy

      public void setLastReservedBy​(Member lastReservedBy)
      Parameters:
      lastReservedBy - MemberID of the person who reserved this book
    • getAuthor

      public String getAuthor()
      Returns:
      Author of the book
    • setAuthor

      public void setAuthor​(String author)
      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

      public Boolean 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

      public Boolean 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

      public String getRentedText()
      FXML use
      Returns:
      Rented status of the book, but in text
    • setRentedText

      public void setRentedText​(String rentedText)
      FXML use
      Parameters:
      rentedText - rented status of the book, but in text
    • getReservedText

      public String getReservedText()
      FXML use
      Returns:
      Reserved status of the book, but in text
    • setReservedText

      public void setReservedText​(String reservedText)
      FXML use
      Parameters:
      reservedText - reserved status of the book, but in text