Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Visualization A Practical Introduction

Authors: Kieran Healy

1st Edition

0691181624, 978-0691181622

More Books

Students also viewed these Databases questions