permaculture playing cards*
The moose likes Beginning Java and the fly likes And Yet Another homework question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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://aspose.com/file-tools
 
subject: And Yet Another homework question