My primary issue is I need to know how to fill an array of type double with values read from a text file.
Update 1.20.12 - So I have made some good progress and now here is what I need help with. In my variable declarations at the beginning of my file I have declared this double array
Expand|Select|Wrap|Line Numbers
- double[] interest = {5.35, 5.5, 5.75};
Next, I have successfully been able to read my text file and to output that to the console window using the following:
Expand|Select|Wrap|Line Numbers
- try{
- FileInputStream fstream = new FileInputStream("InterestFromFile.txt");
- DataInputStream in = new DataInputStream(fstream);
- BufferedReader br = new BufferedReader(new InputStreamReader(in));
- String strLine;
- while ((strLine = br.readLine()) != null) {
- System.out.println (strLine);
- }
- in.close();
- }catch (Exception e){//Catch exception if any
- System.err.println("Error: " + e.getMessage());
- }
Again, thanks ahead of time for your help!