Question
A Book has a title, author, and publishing company (all Strings). Code two constructors (a no-argument constructor and an argument constructor). See page 160 for
A Book has a title, author, and publishing company (all Strings). Code two constructors (a no-argument constructor and an argument constructor). See page 160 for an example with a no-argument constructor, and page 156 Lines 14-18 for an example of a consructor with arguments.
Note": In this program, instance variables are strings, so the no-argument constructor will initialize the instance variables to empty ("") strings.
e.g. title = ""; Add set and get methods.
Add a demo class with the main method and create two book objects using two different constructors (no-argument and argument).
Display the book's information.
Submit Book.java, BookDemo.java, output screenshot.
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