This class includes a constructor that begins on line 8; however, it contains an error. Describe the error. 2. Rewrite the constructor header on line 8 with the error identied in part c of this question corrected. 3. Demonstrate how you might overload the constructor for this class. Write only the header. 4. Write a line of Java code to create an instance (object) of this class. Name it someAuthor. 5. Write a line of code to demonstrate how you would use the someAuthor object created in question 4 to change the author's name to "Stephen King". 6. Write a line of Java code to call the winsAPulitzer method of the Author class using the someAuthor object created in question 10.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

public class Author
2 {
3 private String name;
4 private int numberOfAwards;
5 private boolean guildMember;
6 private String[] bestsellers;
7
8 public String Author()
9 {
10 name = "Grace Random";
11 numberOfAwards = 0;
12 guildMember = false;
13 bestsellers = {"Minority Report", "Ubik", "The Man in the High
Castle"};
14 }
15
16 public void setName(String n)
17 {
18 name = n;
19 }
20 public String getName()
21 {
22 return name;
23 }
24
25 public void winsAPulitzer()
26 {
27 System.out.println(name + " gave a wonderful speech!");
28 }
29 }

1. This class includes a constructor that begins on line 8; however, it contains an error. Describe the error.

2. Rewrite the constructor header on line 8 with the error identied in part c of this question corrected.

3. Demonstrate how you might overload the constructor for this class. Write only the header.

4. Write a line of Java code to create an instance (object) of this class. Name it someAuthor.

5. Write a line of code to demonstrate how you would use the someAuthor object created in question 4 to change the author's name to "Stephen King".

6. Write a line of Java code to call the winsAPulitzer method of the Author class using the someAuthor object created in question 10.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education