Question: Books can come in various formats, like paper books, audio books, ebooks, etc. Create a generic class Book that has as common attributes the title,

Books can come in various formats, like paper books, audio books, ebooks, etc. Create a generic class Book that has as common attributes the title, the year of publication, and the author. The constructor of this class should instantiate all three attributes. Override the toString method of class Book that returns a string that contains the values of its attributes. Create a subclass PrintBook that extends Book with attributes Publisher and ISBN. Create another subclass AudioBook which has the book’s size (in MB), its play length and the playback artist’s name as attributes. Both PrintBook and AudioBook classes override the toString method inherited from Book. Write a Java application to demonstrate the usage of this hierarchy.

Step by Step Solution

3.40 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is a simple implementation of the classes hierarchy as described in your question Well start wi... View full answer

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 Java How To Program Late Objects Questions!