Package com.miniproject.two
Class BookData
java.lang.Object
com.miniproject.two.BookData
- All Implemented Interfaces:
DataInterface
- Direct Known Subclasses:
Book
This abstract class BookData is the base class for Book and Periodical
classes. It contains common fields and methods for all types of literature.
-
Constructor Summary
ConstructorDescriptionBookData
(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) Constructs a BookData object with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns the author of the literature.int
Returns the ID of the book.Returns the username of the user who borrowed the literature.Returns the Dewey decimal classification.getGenre()
Returns the genre of the literature.getISBN()
Returns the ISBN of the literature.Returns the nationality of the author.Returns the publication format of the literature.int
Returns the year the literature was published.Returns the name of the publisher.Returns the subgenre of the literature.getTitle()
Returns the title of the literature.boolean
Returns whether the literature is available or not.void
Prints the data of the implementing class.void
Prints the footer for the data structure.void
Prints the header for the data structure.void
printRow()
Prints a row of data.void
Sets the author of the literature.void
setAvailable
(boolean available) Sets whether the literature is available or not.void
setBorrowedByUserName
(String borrowedByUserName) Sets the username of the user who borrowed the literature.void
setDeweyDecimal
(String deweyDecimal) Sets the Dewey decimal classification of the literature.void
Sets the genre of the literature.void
Sets the ISBN of the literature.void
setNationality
(String nationality) Sets the nationality of the author.void
setPublicationFormat
(String publicationFormat) Sets the publication format of the literature.void
setPublishedYear
(int publishedYear) Sets the year the literature was published.void
setPublisherName
(String publisherName) Sets the name of the publisher.void
setSubgenre
(String subgenre) Sets the subgenre of the literature.void
Sets the title of the literature.
-
Constructor Details
-
BookData
public BookData(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) Constructs a BookData object with the given parameters.- Parameters:
bookId
- the ID of the booktitle
- the title of the bookauthor
- the author of the bookisbn
- the ISBN of the bookgenre
- the genre of the booksubgenre
- the subgenre of the booknationality
- the nationality of the book's authorpublicationFormat
- the publication format of the bookpublishedYear
- the year the book was publishedpublisherName
- the name of the publisherdeweyDecimal
- the Dewey decimal classification of the bookisAvailable
- whether the book is available or notborrowedByUserName
- the username of the user who borrowed the book
-
-
Method Details
-
getBookId
public int getBookId()Returns the ID of the book.- Returns:
- the ID of the book
-
getTitle
Returns the title of the literature.- Returns:
- the title of the literature
-
getAuthor
Returns the author of the literature.- Returns:
- the author of the literature
-
getISBN
Returns the ISBN of the literature.- Returns:
- the ISBN of the literature
-
getGenre
Returns the genre of the literature.- Returns:
- the genre of the literature
-
getSubgenre
Returns the subgenre of the literature.- Returns:
- the subgenre of the literature
-
getNationality
Returns the nationality of the author.- Returns:
- the nationality of the author
-
getPublicationFormat
Returns the publication format of the literature.- Returns:
- the publication format of the literature
-
getPublishedYear
public int getPublishedYear()Returns the year the literature was published.- Returns:
- the year the literature was published
-
getPublisherName
Returns the name of the publisher.- Returns:
- the name of the publisher
-
getDeweyDecimal
Returns the Dewey decimal classification.- Returns:
- the Dewey decimal classification
-
isAvailable
public boolean isAvailable()Returns whether the literature is available or not.- Returns:
- true if the literature is available, false otherwise
-
getBorrowedByUserName
Returns the username of the user who borrowed the literature.- Returns:
- the username of the user who borrowed the literature
-
setAvailable
public void setAvailable(boolean available) Sets whether the literature is available or not.- Parameters:
available
- whether the literature is available or not
-
setBorrowedByUserName
Sets the username of the user who borrowed the literature.- Parameters:
borrowedByUserName
- the username of the user who borrowed the literature
-
setTitle
Sets the title of the literature.- Parameters:
title
- the title of the literature
-
setGenre
Sets the genre of the literature.- Parameters:
genre
- the genre of the literature
-
setSubgenre
Sets the subgenre of the literature.- Parameters:
subgenre
- the subgenre of the literature
-
setAuthor
Sets the author of the literature.- Parameters:
author
- the author of the literature
-
setNationality
Sets the nationality of the author.- Parameters:
nationality
- the nationality of the author
-
setISBN
Sets the ISBN of the literature.- Parameters:
isbn
- the ISBN of the literature
-
setPublicationFormat
Sets the publication format of the literature.- Parameters:
publicationFormat
- the publication format of the literature
-
setPublishedYear
public void setPublishedYear(int publishedYear) Sets the year the literature was published.- Parameters:
publishedYear
- the year the literature was published
-
setPublisherName
Sets the name of the publisher.- Parameters:
publisherName
- the name of the publisher
-
setDeweyDecimal
Sets the Dewey decimal classification of the literature.- Parameters:
deweyDecimal
- the Dewey decimal classification of the literature
-
printData
public void printData()Prints the data of the implementing class. This method is meant to output the data in a specific format such as a table. The exact format and contents depend on the implementing class.- Specified by:
printData
in interfaceDataInterface
-
printHeader
public void printHeader()Prints the header for the data structure. This method is intended to print the header section, which usually consists of column names or other relevant headings. The format of the header is determined by the implementing class.- Specified by:
printHeader
in interfaceDataInterface
-
printRow
public void printRow()Prints a row of data. This method is responsible for printing a single row of data. The contents and formatting of the row depend on the implementing class.- Specified by:
printRow
in interfaceDataInterface
-