Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java expert please help me the program below? Here is the requirement. ==== Book.java ==== public class Book { private String title; private String author;

Java expert please help me the program below? Here is the requirement.

image text in transcribed

====Book.java====

public class Book { private String title; private String author; private String isbn; public Book(String t, String a, String i) { title = t; author = a; isbn = i; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((author == null) ? 0 : author.hashCode()); result = prime * result + ((isbn == null) ? 0 : isbn.hashCode()); result = prime * result + ((title == null) ? 0 : title.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Book other = (Book) obj; if (author == null) { if (other.author != null) return false; } else if (!author.equals(other.author)) return false; if (isbn == null) { if (other.isbn != null) return false; } else if (!isbn.equals(other.isbn)) return false; if (title == null) { if (other.title != null) return false; } else if (!title.equals(other.title)) return false; return true; } @Override public String toString() { return "Book [title=" + title + ", author=" + author + ", isbn=" + isbn + " hashcode=" + hashCode() + "]"; } }

====HashPlay.java====

import java.util.HashSet; public class HashPlay { public static void main(String[] args) { Book b1 = new Book("C. S. Lewis", "Out of the Silent Planet", "1234"); Book b2 = new Book("CS Lewis", "Out Of The Silent Planet", "1234"); System.out.println("b1: " + b1); System.out.println("b2: " + b2); HashSet hm = new HashSet(); hm.add(b1); System.out.println("removal of book: " + hm.remove(b2)); System.out.println(hm); } }

class corectly recoy nukes eave uts et enn "What utates two tal US all essentia art ofCis program, two customers calice into your bookstored vahibel agar are They asku someone shecides an acalon as CSL same as Lewis, es Lewis, at Lewis Can you chse your eyes and corectly spe ou hav to spell his entire youte henitsyn correctly to one a books a be a hero manufacturing Paque and diced information. Rech utsiuope and straightforwar

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions