String Tokenizer
I am having trouble using the stringtokenizer to extract the numbers from my file and then find the max and average of them. I kept on getting errors so I have gone back to where it prints out the lines of my file and there are no errors.
Here is the code I have so far:
import java.io.*;
import java.util.StringTokenizer;
class Exam_1 {
public static void main (String[] args) throws IOException {
Exam_1 d = new Exam_1();
d.readMyFile();
}
//Read MyFile
void readMyFile() {
String reader = null;
int recCount = 0;
try { FileReader fr = new FileReader("Exam_1_File.java");
BufferedReader br = new BufferedReader(fr);
reader = new String();
while ((reader = br.readLine()) != null) {
recCount++; System.out.println(recCount + ": " + reader);
}
}
catch (IOException e) {
// catch possible io errors from readLine()
System.out.println("Uh oh, got an IOException error!");
e.printStackTrace();
}
} // end of readMyFile(
} // end of class
Here is my file it is reading from:
import java.text.*;
public class Exam_1_File{
public static void main(String[] args) {
double a = 16.54;
double b = 234.56;
double c = 143.65;
double d = 1.45;
double e = 97.43;
}
}
If anybody can help steer me in the right direction I would really appreciate it.
Thanks

