Question: Need help with coding. I am stuck on an add function. It asked us to test whether can we add a book to the set.

Need help with coding. I am stuck on an add function. It asked us to test whether can we add a book to the set. Here is my code:

Need help with coding. I am stuck on an add function. It

Here is the test code:

asked us to test whether can we add a book to the

And here is the constructor:

public class BookSet implements Set{

private Book[] books;

public BookSet() {

books = new Book[8];

}

public BookSet(Book[] books) {

this.books = books;

}

s a * Adds the specified book to the set * this method returns true if the BookSet was modified * When you run out of space in the Books Array, please use the * extendArray method * to increase the size of the Array o A set can only contain one copy of a Book, so do NOT add duplicates * and return false in this case * @see java.util.Set#add(java.lang. Object) 89 900 O OOOO @Overridel public boolean add(Book arg0) { Book [] adds = new Book [8]; BookSet bookAdds = new BookSetCadds); for(int i = 0; i

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!