Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume you are given a class called Publisher that has two attributes publisherID and name of type String. There is another class called Book that
Assume you are given a class called Publisher that has two attributes publisherID and name of type String. There is another class called Book that has three attributes title of type String, authorName of type String and p of type Publisher, the constructor of class Book can be written as: public Book (String t, String an, Publisher pub) { title = t; authorName=an; p.publisherID = pub. publisherlD; p.name = pub.name; public Book(String PID, String n) {title = "Unknown", authorName = "Unknown"; publisherD=plD; name = n; public Book(String t. String an, String p1, String n) { title=t; authorName=an; p = new Publisher(p1, n): } public Book (String t, String an) {title=t; authorName=an; publisherID = "Unknown"; name = "Unassigned"; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started