Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design and implement a class called Book that containsinstance data for the titl

ID: 3616933 • Letter: D

Question

Design and implement a class called Book that containsinstance data for the title, author, publisher, and copyright date.Define a Book constructor to accept and initialize this data.Include setter and getter methods for all instance data. Include atoString method that returns a nicely formatted, multi-linedescription of the book. Create a driver class called Bookshelfwhose main method instantiates and updates, several Bookobjects. THANKS SO MUCH! Design and implement a class called Book that containsinstance data for the title, author, publisher, and copyright date.Define a Book constructor to accept and initialize this data.Include setter and getter methods for all instance data. Include atoString method that returns a nicely formatted, multi-linedescription of the book. Create a driver class called Bookshelfwhose main method instantiates and updates, several Bookobjects. THANKS SO MUCH!

Explanation / Answer

please rate - thanks import java.util.*; public class BookShelf { public static void main(String[] args) { String title,author,publisher,copyright,output; Scanner input = new Scanner(System.in); System.out.print("Enter title: "); title=input.nextLine(); System.out.print("Enter author: "); author=input.nextLine(); System.out.print("Enter publisher: "); publisher=input.nextLine(); System.out.print("Enter copyright: "); copyright=input.nextLine(); Book bk=new Book(title,author,publisher,copyright); title=bk.getTitle(); publisher=bk.getPublisher(); author=bk.getAuthor(); copyright=bk.getCopyright(); System.out.println("Original"); output=bk.toString(title,author,publisher,copyright); System.out.println(output); System.out.print("Enter new title: "); title=input.nextLine(); bk.setTitle(title); System.out.print("Enter new author: "); author=input.nextLine(); bk.setAuthor(author); System.out.print("Enter new publisher: "); publisher=input.nextLine(); bk.setPublisher(publisher); System.out.print("Enter new copyright: "); copyright=input.nextLine(); bk.setCopyright(copyright); title=bk.getTitle(); publisher=bk.getPublisher(); author=bk.getAuthor(); copyright=bk.getCopyright(); output=bk.toString(title,author,publisher,copyright); System.out.println("with changes"); System.out.println(output); } } --------------------------------------- public class Book { private String author; private String title; private String publisher; private String copyright; public Book( String a,String t,String p, String c) { author=a; title=t; publisher=p; copyright=c; } public String getAuthor( ) { return author; } public String getTitle( ) { return title; } public String getPublisher( ) { return publisher; } public String getCopyright( ) { return copyright; } public void setAuthor(String a) {author=a; } public void setTitle(String a) {title=a; } public void setCopyright(String a) {copyright=a; } public void setPublisher(String a) {publisher=a; } public String toString( String a,String t,String p, String c) {String out="Current Book Title: "+t+" Author: "+a+" Publisher:"+p+" Copyright: "+c; return out; }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote