- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 3
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
21 Posted Topics
You need a constructor in your program, which you don't have. So, you want a method with the same name as your class, that accepts an array as an argument. Here's a little more on constructors: [url]http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html[/url] Also, you want a method that returns an average of the test scores. …
You should look up classes in Java, their methods, and constructors. I'll give you a basic implementation of the Address class in order to get you started. What I have here is an Address class, with all of the variables you mentioned, and a constructor (the method with the same …
I'm not really expecting any new toys this Christmas. I did finish a networked tetris game I was working on yesterday, and I just got virtualbox for my mac. That's good enough I guess.
I wasn't sure whether to put this question here or in the Windows section, but I was wondering if there was a way to put images into a Visual C++ project. That way, I won't have to load an image from an outside directory, and it will already be in …
Your conditions for your if statements are doubles, which doesn't make any sense. You should be trying to verify a condition in if and else if statements, so putting a double from an array of doubles like if(price[0]) won't work.
So I have a client/server application and I'm trying to send an ArrayList of objects to the server. I kept getting errors sending the ArrayList of objects, so I just decided to send an empty ArrayList to see if anything was wrong, and it turns out, that the server can't …
Could you give us the error message? The java compiler usually tells you what line a NullPointerException is on, and that could help with debugging. Also, you should use [code] tags to make your post more readable.
Did you initialize w? What are the weird numbers that are printing out? Could you post more of the code?
I compiled your code and ran it, and it showed the average. I'm not sure why you aren't seeing it. If you want to do a function call, the help jonsca provided should be sufficient, but from what I can tell, your code is working fine now.
Do you need the catch IOException in the loop? Doesn't the one outside of the loop take care of the same thing? Maybe that's your problem.
The toString() method has public access privileges which you can't change. If you want to override it, you need to make your method public as well. Also, the toString method returns a String, while yours returns void. Change your method name to: public String toString(). And return a String in …
Could you post the Scorer class? I can't really find anything wrong with what you've done, but maybe a look at the other class will help.
It sounds like you just want to access some fields form this class? So I guess in the date class, you would just construct a new Patient object and access the date of birth with the getDOB() method: Patient p = new Patient(......); String birth = p.getDOB();
You can construct a stringbuffer from the string you want to modify, then use the insert method to insert a "." in the desired place. Then use the stringbuffer's toString() method to convert it back to a string. You can't put decimals in integers.
Well, I took out the PI constant, and everything worked. That might be your problem. Also, as the poster below me said, you have curly quotations on one of your lines.
You could use the args array you have, and have the imageLocation = args[0] where args[0] is the string entered right after the command to execute the program: java FinalExam imageLocationhere
Hi, so I compiled your code and got everything to work. You can keep the two files separate, that's fine. I'm not sure why you're getting the constructor error. Do you have the two files in the same directory? The only problem I found was how you were formatting the …
Remove the brace at line 3. You're just declaring functions, and that shouldn't be included in anything. Put int main() in front of the brace at line 10 and put a closing brace after the return 0.
You have Tree t = new Tree(); but the class you defined is "tree" in lower case. Change the line to lower case "tree", or change the class to upper case.
Well, you have an array of LinkedLists, not an array of Strings. You can't just read the next line and put it into the array. You have to put it into the Linked List, which is in the array.
For the isComplete() method, you can use the wordLength at the top. I would add an integer every time there was a correct guess and once the number of correct guesses equals the wordLength, return true.
The End.