Hey guys, I am working on a project right now to create a simple library system. I am trying to compile, but I am getting "Incompatible Types; Found : Book; Required java.lang.string" It is on the lines that return b in the available books constructor.
Here is the code I have so far:
Also, my goal with the availableBooks constructor is to get it to where the book doesn't appear on the list of available books when it is borrowed. How could I rearrange my constructor to accomplish this?
Never write == true. You simply write if (b) . . .
Never write == false. You simply write if (!b) . . .
Those forms with == are both poor style, and you can get all sorts of nasty errors if you mistakenly write = instead of ==. You do in fact appear to have written = instead of == in at least one place.
Also you ought to give the borrowed attribute private access, then you can access it with an isBorrowed method. You ought not to get direct access to fields of an object.