Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

I am trying part two in this assignment http://ocw.csail.mit.edu/f/14 I am on the part where I have to make a method to add books to the library and I have a method which should would but the problem I am having is the the way the parameter is passed to addBook is like this addBook(new Book("The Davinci Code")) So it is of type Book not string and when I try to print out the array of books I am getting @234bh23 <--not this exactly but you get the idea. public void addBook(Book Title){ if (Title != null && numBooks <7){ Books[numBooks] = Title; numBooks++; System.out.println(B

OpenStudy (rsmith6559):

A large part of your problem is that your not keeping Book and Library separate. Creating a book is separate from adding that book to the Library collection.

OpenStudy (anonymous):

Thanks I found the solution on a forum. I had to override the toString method.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!