• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

And Yet Another homework question

 
Richard Chambers
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic