Computers and Technology

(Java) Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Unless otherwise noted in the question, assume that parameters in method calls are not null and that methods are called only when their preconditions are satisfied.
In writing solutions for each question, you may use any of the accessible methods that are listed in classes defined in that question. Writing significant amounts of code that can be replaced by a call to one of these methods will not receive full credit.

The following Book class is used to represent books and print information about each book. Each Book object has attributes for the book title and for the name of the book’s author.

public class Book

{

private String title;

private String author;

public Book(String t, String a)

{

title = t;

author = a;

}

public void printBookInfo()

{

System. out. print(title + ", written by " + author);

}

}

(a) The PictureBook class is a subclass of the Book class that has one additional attribute: a String variable named illustrator that is used to represent the name of the illustrator of a picture book. The PictureBook class also contains a printBookInfo method to print the title, writer, and illustrator of a picture book.

Consider the following code segment.

PictureBook myBook = new PictureBook("Peter and Wendy", "J. M. Barrie",

"F. D. Bedford");

myBook. printBookInfo();

The code segment is intended to print the following output.

Peter and Wendy, written by J. M. Barrie and illustrated by F. D. Bedford

Complete the PictureBook class below. Your implementation should conform to the example above.

public class PictureBook extends Book

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 14:30, dianathedad
Including a space in the file name causes problems on all operating systems?
Answers: 1
image
Computers and Technology, 22.06.2019 07:30, tinasidell1972
An endless cycle of creation and response on the internet is called
Answers: 1
image
Computers and Technology, 22.06.2019 10:30, hope564
Dave has to create animations for a game. which tool can dave use?
Answers: 3
image
Computers and Technology, 24.06.2019 02:30, journeyhile5
How to apply the fly in effect to objects on a slide
Answers: 1
Do you know the correct answer?
(Java) Assume that the classes listed in the Java Quick Reference have been imported where appropri...

Questions in other subjects:

Konu
Mathematics, 17.12.2020 21:10
Konu
Mathematics, 17.12.2020 21:10
Konu
English, 17.12.2020 21:10