Toshiro Hitsuguya

Greenhorn
+ Follow
since May 15, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Toshiro Hitsuguya

Yeah I am wondering the same thing. I guess I am so used to using visual studios. which UI design is a cinch.
9 years ago
Never mind. I had the values reversed. it should be address = street Thanks anyway.
11 years ago
Sure, I am trying to set the value of address to the argument in the constructor.
11 years ago
Thanks a lot Phil. I got my code up and running and works fine. I am having a weird error. I put the firstLibrary.printAddress() into System.out.println() and it is printing out null. I was looking at the structure of my Book class for getTitle() and the Book constructor and it is the exact same structure.
11 years ago




My problem is that whenever I run this everything runs fine. Except when I print the avalible books, it prints the exact same book 4 times. I know that it creates an array, because it prints out four times. However, I can't figure out why it prints out the last book added only.
11 years ago
hmm... Why isn't this piece of code creating the array? :



11 years ago
Ok. I am kind of lost. I am not sure how my variable for addBook is wrong. I am creating a new instance of the book class like my method addBook is supposed to do. I tried to remove static on my books varible and I also removed void and it is still giving me the nullPointer exception. How do I change my constructor or variable so that it builds an array?
11 years ago
Thanks, Henry. I fixed my code and it compiled. Excuse me for keeping this thread open, I am pretty new at Java. When I ran it it throws the run time error of : java.lang.NullPointer. at Library.addBook(Library.java:10) ; at Library.main(Library.java:60). I looked online and this exception was caused with an illegal use of null. Like if you try to divide a null variable with a number.

Why is it telling me this?

Anyways, here is my final code:



Thank you for your patience,
Brian
11 years ago
I have also tried to change it to firstLibrary.borrowBook(books[1]); and it is telling me a "non-static varible cannot be referenced from a static context".
11 years ago
Thanks for replying. Ok, so I tried to insert book into my methods so that: firstLibrary.returnBook(Book("The Lord of the Rings")); . Now it is telling me that the symbol for Book isn't found. I though this was the proper return type?

11 years ago
I am trying to write a program that simulates a simple libraray. I am having some trouble applying some of the methods to the main method.

Here is my code so far:



Here are the main errors that I am getting:

borrowBook(Book) in Library cannot be applied to (java.lang.String)
firstLibrary.returnBook("The Lord of The Rings")

printAvailbleBooks(Book) in Library cannot be applied to ()
System.out.println(secondLibrary.printAvailableBook())

array required but Book found
System.out.println(b[numBooks])

a non-static method printOpeningHours() cannot be referenced from a static context
printOpeningHours()

Also the borrow and return book methods reference another method in my book class.

How can I fix these errors?

and

How could I write this code so that it will mark a book as borrowed and print out "Sorry that book is checked out" when ever someone tries to borrow it again?

Thanks a lot,
Brian
11 years ago


I am trying to call the moveInDirection method in this other class:




Whenever, I try to call the method in my bouncing ball class, the constructor says "invalid method declaration; return type required". How can I fix it?

Thank You
11 years ago
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?
11 years ago
Sure. Thanks. It's very simple. I went through the number of } and found that I had too many. Simple error. Erased one and worked fine.
11 years ago