Answer:
Here is the Encyclopedia class:
public class Encyclopedia extends Book { //class Encyclopedia that inherits from class Book
private String edition; //declare private member variable edition of type String
private int numVolumes; //declare private member variable numVolumes of type int
public void setEdition(String ed) { //mutator method of class that sets the value of edition
edition = ed; }
//assigns the value of ed to edition member field
public void setNumVolumes(int numVol) {
//mutator method of class that sets the value of numVol
numVolumes = numVol; } //assigns the value of numVolumes to edition member field
public String getEdition() { //accessor method to get the value of edition
return edition; }
//returns the current value of edition
public int getNumVolumes() { //accessor method to get the value of numVolumes
return numVolumes; }
//returns the current value of numVolumes
public void printInfo() { //method to print edition and number of volumes information on output screen
super.printInfo(); // The super keyword refers to parent class Book objects. It is used to call Book method and to eliminate the confusion between Book class printInfo method and Encyclopedia printInfo method
System.out.println(" Edition: " + edition); //prints edition info
System.out.println(" Number of Volumes: " + numVolumes); } } //prints number of volumes info
Explanation:
The explanation is provided in the attached document.