Reference no: EM13165506
modify the Book class to accommodate multiple authors using one of the components from the Java Collection Framework. Can you help? Thanks! (Please only answer in Java codes) I just noticed that I need to revise the boolean equals. and validate part since they are not right? I'm so lost!!!
Here is the codes that I already have for class Book:
package book;
public class Book {
private String author;
private String title;
private String isbn;
public Book() {
super();
isbn="";
author="";
title = "";
}
public Book(String author, String title, String isbn) {
this.author = author;
this.title = title;
this.isbn = isbn;
}
public String getAuthor(){
return this.author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle(){
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getIsbn() {
return this.isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public boolean equals(Object obj) {
Book book = (Book) obj;
return this.getAuthor().equals(getAuthor()) && (this.getIsbn().equals(getIsbn())) && (this.getTitle().equals(getTitle()));
}
public boolean validate(){
return (this.getIsbn().trim()!= null) && (this.getAuthor().trim()!= null) && (this.getTitle().trim()!=null);
}
}