• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

And Yet Another homework question

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic