This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes And Yet Another homework question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "And Yet Another homework question" Watch "And Yet Another homework question" New topic
Author

And Yet Another homework question

Richard Chambers
Ranch Hand

Joined: Apr 03, 2008
Posts: 40
First pseudocode:


Now what I have (obviously wrong):



I'm stuck. I "think" it's not liking the Double.parseDouble part,
but thats my uneducated guess.

Also, what exactly does the Double.parseDouble do?
I thought it read a String and converted it to a double,
but the indexForBalance is a static final int field.
Actually, all the parameters are static final int fields.
This coding is in the main method and all the fields are declared
and initialized in this class file.

Thanks
[ April 08, 2008: Message edited by: Richard Chambers ]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Richard Chambers:
... I thought it read a String and converted it to a double, but the indexForBalance is a static final int field. Actually, all the parameters are static final int fields...

"indexForBalance" might be an int, but "myFields[indexForBalance]" is a reference to whatever is in the array myFields at the index represented by indexForBalance. I'm guessing myFields is a String array.

(By the way, identifiers for static final fields are conventionally written in uppercase with underscores. For example, INDEX_FOR_BALANCE.)

Are you getting a compiler error? If so, what is it?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: And Yet Another homework question
 
Similar Threads
Exeception in thread
Program Errors un resolved
Exception in thread
Double.parseDouble Help
Exception "main" java