Question: Design and implement an inheritance hierarchy to model different library items, including books, magazines, journals, videos, and electronic media such as CDs . Your design

Design and implement an inheritance hierarchy to model different library items, including
books, magazines, journals, videos, and electronic media such as CDs. Your design should
encapsulate the common attributes and behaviors in a superclass and extend it with subclasses
that represent specific types of library items.
Superclass - LibraryItem:
Fields:
uniqueID: A unique identification number for each library item.
title: The title of the item.
author/publisher: Depending on the item, this could be the author (for books) or
publisher (for magazines and journals).
yearPublished: The year the item was published.
Methods:
displayInfo(): Prints the common information about the item.
Appropriate getter and setter methods.
Subclasses: Design the following three subclasses from the following options, each with its
specific fields and methods:
Book:
Specific fields: genre, pageCount
Specific methods: Include methods relevant to a book, such as readPage(int
pageNumber).
Video:
Specific fields: runtimeLength (in minutes), director
Specific methods: Include methods relevant to videos, such as play() or
displayRuntime().
CD:
Specific fields: genre, artist, trackCount
Specific methods: Include methods relevant to CDs, such as playTrack(int trackNumber)
or displayArtistInfo().
Demonstration:
Create a main program that demonstrates the use of your classes. Instantiate objects of each
subclass and demonstrate setting their fields and calling their methods.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!