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
lukranit [14]
2 years ago
12

Book information (overriding member methods) Given main() and a base Book class, define a derived class called Encyclopedia. Wit

hin the derived Encyclopedia class, define a printlnfomethod 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 & Unwin 21 September 1937 The Illustrated Encyclopedia of the Universe James W. Guthrie Watson-Guptill 2001 2nd 1 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: James W. Guthrie Publisher: Watson-Guptill Publication Date: 2001 Edition: 2nd Number of Volumes: 1 Note: Indentations use 3 spaces 261744 1399928 LAB ACTIVITY 11.17.1: LAB: Book information (overriding member methods) 0/10 File is marked as read only Current file: BookInformation.java 1 import java.util.Scanner; 3 public class BookInformation 2
Computers and Technology
1 answer:
IgorC [24]2 years ago
8 0

Answer:

Explanation:

The Book class and BookInformation class was not provided but was found online. After analyzing both of these classes I have created the following code that grabs and overrides the printInfo() method in order to add and print the edition and number of volumes as well

public class Encyclopedia extends Book {

   String edition;

   int numVolumes;

   public String getEdition() {

       return edition;

   }

   public void setEdition(String edition) {

       this.edition = edition;

   }

   public int getNumVolumes() {

       return numVolumes;

   }

   public void setNumVolumes(int numVolumes) {

       this.numVolumes = numVolumes;

   }

   public void printInfo() {

       System.out.println("Book Information: ");

       System.out.println(" Book Title: " + super.title);

       System.out.println(" Author: " + author);

       System.out.println(" Publisher: " + publisher);

       System.out.println(" Publication Date: " + publicationDate);

       System.out.println(" Edition: " + getEdition());

       System.out.println(" Number of Volumes: " + getNumVolumes());

   }

}

You might be interested in
Write a program named as calcPrice.c that formats product information entered by the user and calculate the total amount of purc
Colt1911 [192]

Answer:

Here is the calcPrice.c program:

#include <stdio.h>   //to use input output functions

int main(void)  {  //start of main method

   int itemNo, month, day, year, quantity;  //declares variables to hold item number, quantity, and date

   float unitPrice; //declare variable to hold price per unit

   printf("Enter item number: ");  // prompts user to enter item number

   scanf("%d", &itemNo);  //reads item number from user and stores it in itemNo variable

   printf("Enter unit price: ");  // prompts user to enter unit price

   scanf("%f", &unitPrice);  //reads input unit price and stores it in unitPrice variable

   

    printf("Enter quantity: ");  //prompts user to enter quantity

   scanf("%d", &quantity);  //reads input quantity and stores it in quantity variable

   printf("Enter purchase date (mm/dd/yyyy): ");  //prompts user to enter purchase date

   scanf("%d/%d/%d", &month, &day, &year);  //reads input date and stores it in month, day and year variables

    float totalAmount = unitPrice * quantity;  //computes the total amount

   printf("\nItem\tUnit Price\tQTY\tPurchase Date\tTotal Amount\n");  //displays the item, unit price, qty, purchase data and total amount with tab space between each

   printf("%d\t$%5.2f\t%d\t%.2d/%.2d/%d\t$%5.2f\n", itemNo, unitPrice,quantity, month, day, year,totalAmount);   }    //displays the values of itemNo, unitPrice, quantity, month, day, year and computed totalAmount with tab space between each

Explanation:

Lets suppose user enters 583 as item number, 13.5 as unit price, 2 as quantity and 09/15/2016 as date so

itemNo = 583

unitPrice = 13.5

quantity = 2

month = 09

day = 15

year = 2016

totalAmount is computed as:

  totalAmount = unitPrice * quantity;

 totalAmount = 13.5* 2

totalAmount = 27.00

Hence the output of the entire program is:

Item    Unit Price      QTY     Purchase Date   Total Amount      

583     $  13.50           2           09/15/2016         $  27.00  

The screenshot of the program along with its output is attached.

4 0
2 years ago
According to your​ reading, Macy's uses​ ________ technology to track individual items for sale on store shelves.
Setler79 [48]
She uses the Radio-frequency identification(RFID) which is a technology that uses electromagnetic fields to automatically identify and track tags attached to objects.These tags contain electronically-stored information.the passive tags collect energy from a nearby RFID readers interrogating radio waves.They contain an integrated circuit and an antenna which are used to transmit data to the RFID reader also called an interrogator.
8 0
3 years ago
Read 2 more answers
Clara works behind a computer all day. She gets a lot of headaches, and her eyes have been hurting her lately. Her doctor diagno
Vinil7 [7]

Answer:

Clara should use computer lenses and artifical tears.

The computer lenses help block blue light from entering your eyes which would help with the headaches and help you focus on something further away. The artificial tears help lubricate dry eyes which prevents or in Clara's case, reduces/relieves eye strain.

8 0
2 years ago
Code works, need help writing header file.
vovikov84 [41]

Answer:

kbfbnmcj hbx nmjn mz kjn  mj     hk hhhhhhgdhggbddddddbvgfcgfctrctgvhyubujbnjinkikmokimloplkmkojihgftrdesw3l,kmjinhuygtfrde4sw34drftyghuijokkkkkkkkkkkkkkkijjjjjjjkopl[[[[[koiju98hytttttttttttttuhiouhygdtrsgyuihkl;;ihugydtrcfbhjklioutrcgfbhjkloiuytdrhjukliuytrdgfhjkiouy7gfhjklpoiudtrkhjl;[poiughjbnm,;lkihuygtfvbnmjkiuytfgchvbnmkjlhuygfdc vbnhnjkygtdsfxghbjkiuhytrdgfhjuioytrdfgchbnmkloiuytfdfghjiouyyyyyyhjkpoi8u97t6rdghjuo0987hjklpo0i98uyghjbkopiuyhjbnkploiuhyjbnmkloiuhygbvjnmk,l;oipuhgbjkn mjhuygfvbnhjkiouuuukjopipkjmloiujoklm;okjm,kloiuhjnmkiuhjbkiuygfhuji8yghyugfvhjkjiuhygfhuijokpiuyt67u89poiuhygftduhjklphuytfrdesdtgyuhi;lkyuuuugij'[;;;;;;;;;;;;;;;;;;;;okpuuuutyyyyy[poiudtryuiop[;oiudtrruiooooooooytg[pl;oiuhygtfffkjjjjhugvcfxkml,;kjnhbgvchbjnk,lijuhygfcbvh nmmpoiugyhjb,m ./[poiuhbjnm,k;lijuytfrcgbvhkjlipouuuujipouuuukliouygkjliubhjkml

Explanation:

7 0
3 years ago
True or False?
Nadya [2.5K]

False.

The different between break and continue instruction is that with break you exit the loop, and with continue you skip to the next iteration.

So, for example, a loop like

for(i = 1; i <= 10; i++){

   if(i <= 5){

       print(i);

   } else {

       break;

   }

}

will print 1,2,3,4,5, because when i=6 you will enter the else branch and you will exit the loop because of the break instruction.

On the other hand, a loop like

for(i = 1; i <= 10; i++){

   if(i % 2 == 0){

       print(i);

   } else {

       continue;

   }

}

Will print 2,4,6,8,10, because if i is even you print it, and if i is odd you will simply skip to the next iteration.

6 0
3 years ago
Other questions:
  • An _________ is a phrase formed from the first letters of words in a set phrase or series of words a. Acronymic sentence c. Basi
    7·2 answers
  • Class CTRivers describes collection of CT rivers. It has no data, and it provides the following service methods. None of the met
    13·1 answer
  • .Ashley is creating a new logo for her client that should be a vector graphic. Which is classified as a vector editing software?
    8·1 answer
  • How can you crop a photo in PowerPoint?
    15·2 answers
  • What does a page break do?
    13·1 answer
  • Send me the answers<br>​
    15·1 answer
  • The function of anOR gate can best be described as a gate which provides an output of 1 only when
    10·1 answer
  • Please answer this simple (hard) question for me lol
    13·2 answers
  • How do you initiate a sprite’s actions in a scene?
    8·1 answer
  • 23. Convert the following to Megabytes<br> a) 2GB<br> b) 2056 Bytes-
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!