1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kenny6666 [7]
4 years ago
10

Given main() and a base Book class, define a derived class called Encyclopedia. Within the derived Encyclopedia class, define a

printInfo() method that overrides the Book class' printInfo() method by printing not only the title, author, publisher, and publication date, but also the edition and number of volumes. Ex. If the input is: The Hobbit J. R. R. Tolkien George Allen

Computers and Technology
1 answer:
NemiM [27]4 years ago
7 0

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.

You might be interested in
Which of these about non-disclosure agreements is accurate?
grandymaker [24]

Answer: number 2

Explanation: number 2

6 0
3 years ago
Read 2 more answers
The area that holds all the startup instructions the computer needs to start is the
Zigmanuir [339]
The area that holds all the startup instructions the computer needs to start is the ROM, or read-only memory. 
8 0
3 years ago
Which step in the software development life cycle involves making improvements based on user feedback?
AnnZ [28]

Answer:

Maintenance is the answer

5 0
3 years ago
All of the following can cause a fatal execution-time error except: Group of answer choices Dereferencing a pointer that has not
7nadin3 [17]

Answer: Dereferencing a variable that is not a pointer

Explanation:

The execution time also refered to as the CPU time pertaining to a given task is the time that is used by the system to execute a task.

Some of the reasons for a fatal execution-time error include:

• Dereferencing a pointer that has not been initialized properly

• Dereferencing a null pointer

• Dereferencing a pointer that has not been assigned to point to a specific address.

It should be noted that dereferencing a variable that is not a pointer doesn't cause a fatal execution-time error.

6 0
3 years ago
What must be done before using ArrayLists?<br><br> (This is Java Programming btw)
Viktor [21]

Answer:

to create an ArrayList , you declare an Arraylist variable and call the ArrayList constructor to instantiate and ArrayList object and assign it to the variable

5 0
3 years ago
Other questions:
  • Discus the pros and cons of Internal cloud service and External cloud service for both Infrastructure as a service and Applicati
    11·1 answer
  • What is an effective way to display calculations in a Word document
    7·2 answers
  • How does the access point know whether a wireless data packet is intended for its network?
    14·1 answer
  • If you accidentally put an envelope in the Express Mail box will it still get to its destination?
    7·1 answer
  • Write JavaScript code to declare a variable of the name favoriteColor
    13·1 answer
  • A reputable, world-renowned auction house uses blockchain to verify the authenticity of paintings prior to placing them up for s
    7·1 answer
  • Different between input and output device​
    5·1 answer
  • PLZZZZZZZZZZZZZZZ HELP ME OUT!!!!! I SICK AND TIRED OF PEOPLE SKIPING MY QUESTION WHICH IS DUE TODAY PLZ ANSWER ALL OFIT!!!!
    10·1 answer
  • In two to three sentences, define "home row" and explain why it is important.
    6·2 answers
  • Sharing resources.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!