Question: Create a Book object. The same two options for creating a Book object apply here as well. package bookisbnlookup; public class Book { private long

Create a Book object. The same two options for creating a Book object apply here as well. package bookisbnlookup;
public class Book
{
private long isbn;
private String title;
private String description;
public Book()
{
this(0);
}
public Book(long inIsbn)
{
isbn = inIsbn;
title ="";
description ="";
}
public void setIsbn(long inIsbn)
{
isbn = inIsbn;
}
public void setTitle(String inTitle)
{
title = inTitle;
}
public void setDescription(String inDescription)
{
description = inDescription;
}
public long getIsbn()
{
return isbn;
}
public String getTitle()
{
return title;
}
public String getDescription()
{
return description;
}
@Override
public String toString()
{
String text ="--- Book Information ---
";
text += "ISBN: "+ isbn +"
";
text += "Title: "+ title +"
";
text += "Description: "+ description +"
";
return text;
}
} Output the results by printing your Book object to the console. The Book class contains a toString method, you just print your object directly to the console.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!