This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi everybody. I have taken a different approach to the writing of this code. However, when I try to run it, it says possible loss of precision and highlights this line: " theTemps[index] = inFile.next();". I am wondering why it says possible loss of precision. Thanks
David Barry wrote:ok. and what is the purpose of the array index again? I forget.
think of an array as an egg carton - it simply holds things. The index is used to identify the SPECIFIC egg in the carton. So, would you say "Take egg #3.2 out of the egg carton"?
probably not. you'd probably only use whole numbers - i.e. numbers without a decimal part.
Never ascribe to malice that which can be adequately explained by stupidity.
David Barry
Ranch Hand
Joined: Jan 13, 2009
Posts: 83
posted
0
What do you think my third problem is? I now have this code that compiles, but does not print out my doubles from the text file.
Ernest Friedman-Hill
author and iconoclast
Marshal
David Barry wrote:What do you think my third problem is? I now have this code that compiles, but does not print out my doubles from the text file.
Your 3rd problem is that your index is not moving. To take someone else's example, you are smashing each new egg you pick up from inFile, into the same spot, every time through the loop. What happens to the metaphorical eggs, is what happens to your previous numbers.
you need to be incrementing the value of index, each time through the loop.
Finally, you might encounter a fourth problem (ponder what happens when there are more than 14 values in the file you are reading)
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
4
posted
0
You would have done better to post this as a continuation of your earlier thread. And I have already told you "Somebody please take a look at this" is not a suitable thread title.
I am not getting at you. We want to help, but it is more difficult if you don't keep threads together, or use such vague titles.