Package com.miniproject.two
Class Book
java.lang.Object
com.miniproject.two.BookData
com.miniproject.two.Book
- All Implemented Interfaces:
DataInterface
Class representing a book in a library.
Extends BookData to inherit common book data fields.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Prints the book's data in a formatted table.void
Prints the footer for the book table in a formatted table.void
Prints the header for the book table in a formatted table.void
printRow()
Prints the book's data in a formatted table row.Methods inherited from class com.miniproject.two.BookData
getAuthor, getBookId, getBorrowedByUserName, getDeweyDecimal, getGenre, getISBN, getNationality, getPublicationFormat, getPublishedYear, getPublisherName, getSubgenre, getTitle, isAvailable, setAuthor, setAvailable, setBorrowedByUserName, setDeweyDecimal, setGenre, setISBN, setNationality, setPublicationFormat, setPublishedYear, setPublisherName, setSubgenre, setTitle
-
Constructor Details
-
Book
public Book(int bookId, String title, String author, String ISBN, String genre, String subgenre, String nationality, String publicationFormat, int publishedYear, String publisherName, String deweyDecimal, boolean isAvailable, String borrowedByUserName) Constructor for Book.- Parameters:
bookId
- book bookIdtitle
- book titleauthor
- book authorISBN
- book ISBNgenre
- book genresubgenre
- book subgenrenationality
- book author's nationalitypublicationFormat
- book publication formatpublishedYear
- book published yearpublisherName
- book publisher's namedeweyDecimal
- book Dewey decimal numberisAvailable
- book availability statusborrowedByUserName
- book's borrower username, if any
-
-
Method Details
-
printData
public void printData()Prints the book's data in a formatted table.- Specified by:
printData
in interfaceDataInterface
- Overrides:
printData
in classBookData
-
printHeader
public void printHeader()Prints the header for the book table in a formatted table.- Specified by:
printHeader
in interfaceDataInterface
- Overrides:
printHeader
in classBookData
-
printRow
public void printRow()Prints the book's data in a formatted table row. This method overrides the printRow() method from the superclass and prints the book's data in a formatted table row. The data includes the book ID, title, author, ISBN, and availability status. The data is formatted using the ANSI_YELLOW and ANSI_RESET constants for coloring.- Specified by:
printRow
in interfaceDataInterface
- Overrides:
printRow
in classBookData
-