Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
//here is my code but whenever I compile and run the program, it gives me the first line in the //file // here is the file: //1,2,3,4,5,6,7 //2541.36,2965.88,1965.32,1845.23,7021.11,9652.74,1469.36 //2513.45,1963.22,1568.35,1966.35,1893.25,1025.36,1128.36 //so how do I read the next line in this file
Please use code tags; they make the quoted code much easier to read.
Why are you using StringTokenizer in the first place? You should be able to get the String already parsed into tokens from a Scanner. And StringTokenizer is classed as legacy code in the API. You can save yourself a lot of bother with DecimalFormat objects by using the printf() method of System.out (PrintStream). If you are using Scanner, it consumes Exceptions, so you can simply call if(myScanner.IOException() != null) myScanner.IOException.printStackTrace(); which is better than simply catching Exception and then assuming it is a FileNotFoundException, as you do. BTW: If you insist on catching Exception, then your declaration of throws IOException is unnecessary.
You can use the nextLine() method of Scanner to read a line; you simply call it as many tiems as you like. Probably safest in a while(myScanner.hasNextLine()) loop. But if you are using double values, go through the Scanner class API for a method which reads doubles directly.
no wonder he is so sad, he hasn't seen this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss