Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

Here is the test code:

image text in transcribed

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

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago