Question: Given a Book base class, define a subclass called Encyclopedia with member methods to get and set private fields of the following types: String to

Given a Book base class, define a subclass called Encyclopedia with member methods to get and set private fields of the following types:
String to store the edition
int to store the number of pages
In the Encyclopedia subclass, define a tostring () method that adds the two additional fields to the result from the tostring () method from the Book class. Look at the implementation of toString () in the Book class to get a sense of how to implement the toString in Encyclopedia (the tostring method in Encyclopedia needs to use the super keyword to call the toString method in Bk).
Ex. If the input is:
The Hobbit
J. R. R. Tolkien
George Allen & Unwin
21 September 1937
The Illustrated Encyclopedia of the Universe
Ian Ridpath
Watson-Guptill
2001
2nd
384
the output is:
Book Information:
Book Title: The Hobbit
Author: J. R. R. Tolkien
Publisher: George Allen & Unwin
Publication Date: 21 September 1937
Book Information:
Book Title: The Illustrated Encyclopedia of the Universe
Author: Ian Ridpath
Publisher: Watson-Guptill
Publication Date: 2001
Edition: 2 nd
Number of Pages: 384
Note Indentations use 3 spaces.
 Given a Book base class, define a subclass called Encyclopedia with

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the Encyclopedia subclass follow these steps Step 1 Define the Book Class Lets assume the Book class has basic information and a toString ... 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 Databases Questions!