design and implement a class class book that contains instance data.......
807606May 30 2007 — edited May 31 2007Someone please help, I did this problem but I think that its all wrong, please help
Design and implement a class called Book that contains instance data for the title,author,publisher, and copyright date. Defind the Book constructor to accept and initialize this data. Include setter and getter methods for all instance data. Include a toString method that returns a nicely formatted, mult-line description of the book. create a driver class called Bookshelf, whose main method instantiates and updates several Book objects.
This is what I got
import java.util.Scanner;
class Book
{
private String Title;
private String author;
public int copyrightdate;
public Book (String t, inc c){
title=t;
author=a;
copyright date=c;
}
Void setTitle (String t)
{
name=t;
}
Void setAuthor(a) {
Author=a;
}
String getAuthor ()
{
return author;
}
int get copyrightdate()
{
Return copyrightdate;
}
Public String toString()
{
Return new String (�\t |+ title+�is� + author (a) + copyright date:�);
}
}
}
Class Bookshelf
{
public Static void main (String []args){
string Title;
Scanner input= new Scanner (System.in);
System.out.print (�Enter title of book:�);
Int p=input.nextInt();