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
A wet-carpet cleaner that carries its own water supply has water pressure created by a        A. faucet mixing valve.   B. manua
BARSIC [14]
Your answer is most likely C. motor-driven pump
5 0
3 years ago
Which of the following must the designer first do in order to create the software in the following scenario? A multimedia design
Vadim26 [7]
He must explore the components of VHS films so he knows what exactly needs to be done so he software functions property.


Hope it helped,

Happy homework/ study/ exam!
8 0
4 years ago
Read 2 more answers
Which statement below is incorrect when discussing communication in the online community?
Marysya12 [62]
It's everyone's responsibility to report cyberbullying.

The tone is important whenever you are talking to someone else.

You can literally say anything in virtual world, but you should behave yourself

If everybody knows the common text phrases, then it's fine, but it will be better to talk formally.
8 0
3 years ago
Please Help! I will give a Brainliest to anyone who answers with the right answer! Please and Thank You! What view is most often
Nata [24]

Answer:

form is used ethier to display or enter data in access 2016

8 0
3 years ago
Does anyone know how I can make this return a double with 2 decimal places?
dolphi86 [110]

hi :)   .,..............

Explanation:

8 0
3 years ago
Other questions:
  • When you add text to a slide using presentation software, which of the following is important?
    12·2 answers
  • Will a pair of bar magnet ,with keepers on the two ends, act as a magnet
    13·1 answer
  • Jeffery wants to locate reliable academic information on the effects of global warming and ways to conserve energy. What is the
    5·1 answer
  • Write an expression to print each price in stock_prices. Sample output with inputs: 34.62 76.30 85.05
    9·1 answer
  • Which criterion can be used to select the appropriate type of network media for a network?
    8·1 answer
  • Write a C++ function, smallestIndex, that takes as parameters an int array and its size and returns the index of the first occur
    15·1 answer
  • Match the order in which you should develop a plan:
    7·1 answer
  • Question 7<br> What is the description of The Ribbon?
    14·1 answer
  • The banner on the front page of a newsletter that identifies the publication is the:.
    11·1 answer
  • a client device on your network is trying to authenticate via radius proxy, but is failing. you check the relevant policy on the
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!