Question: example attached Problem 2: Books (4 points) Download the program BookTester.java Write a class Book that provides each method needed by BookTester.java to compile and

example attached  example attached Problem 2: Books (4 points) Download the program BookTester.java
Write a class Book that provides each method needed by BookTester.java to

Problem 2: Books (4 points) Download the program BookTester.java Write a class Book that provides each method needed by BookTester.java to compile and run without error, producing the following output: Command Promo C:\java>javac Book.java C:\java>javac BookTester.java C:\java> java BookTester booki is: Great Expectations by Charles Dickens) book2 is: Great Expectations (by Charles Dickens) book3 is: To Kill a Mockingbird (by Harper Lee) booki.equals(book 2): true bookl - book 2: false book2.equals(book 3): false C:\javas The following UML diagram should be adhered to for full credit. For the equals method, it should be tested that both the titles and the authors are equals. The toString method builds the String needed to give the example output. Book Tester Book title : String author: String + main(String[] args) void setile(String new rule) void .setAuthor(String newAuthor) vold .getTitle String getAuthor: String .equals(Book thatBook): boolean toString : String //CS-151 //Homework 3 Problem 2 //This is the client program for the Book class //to be written in this homework problem. //A successful version of Book class will allow //BookTester to run without errors and provide the 1/output as listed in the homework. public class BookTester{ public static void main(String[args) { //create three books Book book1 = new Book(); book1.setTitle("Great Expectations"); book1.setAuthor("Charles Dickens"); Book book 2 = new Book(); book2.setTitle("Great Expectations"); book2.setAuthor( "Charles Dickens"); Book book 3 = new Book(); book3.setTitle("To Kill a Mockingbird"); book3.setAuthor( "Harper Lee"); //display the books System.out.println("bookl is: " + bookl); System.out.println("book2 is: + book 2); System.out.println("book3 is: " + book3); //test if books are equal System.out.println("bookl.equals(book 2): + booki.equals(book)); System.out.println("book1 == book2: + (bookl == book2) System.out.println("book2.equals(book3): + book2.equals(book3)); }//main }//class BookTester

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!