Learning Objectives

To be able to code a class structure with attributes and methods with appropriate access
specifiers. To demonstrate the concepts of inheritance, abstract classes and interfaces. Provide practice
creating objects of different types, overloaded methods, ArrayLists, encapsulation, and static variables.
Create a set of classes for various types of electronic library content. You will create an abstract class for a
general library item, then subclasses for songs, video and books. The abstract parent class will contain
common attributes and the subclasses will have unique attributes for each class. Use a static variable to keep
track of the total number of objects in the library and to assign unique library ID numbers. Each subclass
should include an overloaded constructor for initializing all the values with the exception of the library ID
number, which must be encapsulated. The following provides specific guidance for the class structure;
1) Create an abstract class for a library item. Attributes should include title and library ID. The library ID must
be encapsulated, using a private access specifier and setters/getters for access.
2) Create a subclass for songs. Attributes should include type and artist.
3) Create a subclass for videos. Attributes should include genre, rating, and running time in minutes.
4) Create a subclass for books. Attributes should include author, number of pages, boolean category
fiction/non-fiction.
5) Create an interface (printItem) that is implemented in each subclass. The method will print all the fields of an
object.
6) Create at least 3 of each type of object (you may intiialize them within the program, a user interface for input
is not required) and store them in an ArrayList for each type. Using a loop and your overridden printItem
method, print out all the items in each ArrayList to display the entire library to the user.
7) Use a static variable for total number of objects in the library. Use this count to assign a unique library ID
number for each object created. Print out the total number of objects in the library.
The following is an example of what your output might look like:
This program displays information for all the items in the library and the total number of items.
Library item number 1
The song title is Chandelier
The song type is pop 
3/8/2021 Order 338588703
https://admin.writerbay.com/orders_available?subcom=detailed&id=338588703 3/5
The artist for this song is Sia
Library item number 2
The song title is Sweet Home Chicago
The song type is blues
The artist for this song is Robert Johnson
Library item number 3
The song title is Dynamite
The song type is pop
The artist for this song is BTS
Library item n