Question
Your task for this portion of the assignment is to create classes to represent the different types of items that will be listed in the
Your task for this portion of the assignment is to create classes to represent the different types of items that will be listed in the library's catalog. You will need to create or complete each of the files listed below. Starter code includes Item.java, and Printable.java. It is recommended that you create the classes in the order listed below starting with Book.java.
Book.java
A class to represent books which can be checked out from the library. It must extend the abstract class Item. This means it will need to implement the abstract methods found in Item as well as the ones found in Printable (because Item implements Printable.) It will need to implement the following methods:
public Book( String title, String author, int pages, int year )
The constructor for Book. It should initialize any necessary fields.
public String basicInfo( )
Provides a simple representation of this object's data in the following format:
TITLE, by AUTHOR
public String detailedInfo( )
Provides a detailed representation of this object's data in the following format:
Title: TITLE
Author: AUTHOR
Pages: PAGES
Publication year: YEAR
public void checkOut( LocalDate currDate )
Changes the checked out status of the item to true and sets the due date to be 14 days after currDate.
public boolean contains( String search )
Checks whether this item's data contains the search text provided. Note that this must be done in a case-insensitive manner ("the" and "The" should both return true for "The Hobbit".) It should return true if the search text is contained in the title or author's name.
Video.java
A class to represent videos which can be checked out from the library. It must extend the abstract class Item. This means it will need to implement the abstract methods found in Item as well as the ones found in Printable (because Item implements Printable.) It will need to implement the following methods:
public Video( String title, String format, int year, int runtime )
The constructor for Video. It should initialize any necessary fields.
public String basicInfo( )
Provides a simple representation of this object's data in the following format:
TITLE (FORMAT)
public String detailedInfo( )
Provides a detailed representation of this object's data in the following format:
Title: TITLE
Format: FORMAT
Year of release: YEAR
Runtime (minutes): RUNTIME
public void checkOut( LocalDate currDate )
Changes the checked out status of the item to true and sets the due date to be 3 days after currDate.
public boolean contains( String search )
Checks whether this item's data contains the search text provided. Note that this must be done in a case-insensitive manner ("the" and "The" should both return true for "The Hobbit".) It should return true if the search text is contained in the title only.
Music.java
A class to represent music recordings which can be checked out from the library. It must extend the abstract class Item. This means it will need to implement the abstract methods found in Item as well as the ones found in Printable (because Item implements Printable.) It will need to implement the following methods:
public Music( String title, String artist, String format, int year, ArrayList
The constructor for Music. It should initialize any necessary fields.
public String basicInfo( )
Provides a simple representation of this object's data in the following format:
TITLE by ARTIST (FORMAT)
public String detailedInfo( )
Provides a detailed representation of this object's data in the following format (note that there are 4 spaces before each track name):
Title: TITLE
Artist: ARTIST
Format: FORMAT
Year of release: YEAR
Track list:
TRACK NAME
TRACK NAME
TRACK NAME
public void checkOut( LocalDate currDate )
Changes the checked out status of the item to true and sets the due date to be 7 days after currDate.
public boolean contains( String search )
Checks whether this item's data contains the search text provided. Note that this must be done in a case-insensitive manner ("the" and "The" should both return true for "The Hobbit".) It should return true if the search text is contained in the title, artist's name, or any of the tracks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started