I am a complete beginner in JAVA and now have to do this for a class.
Task is to read a text file and store the values in appropriate places. Its hard to describe the assignment, so all i want to know as a starting step is once you have read a file, how do you do basic things like using the text file to calculate averages.
For example if a line from the text file is
12/1/2009 13 444 43
this line includes a date and three different numbers.
How do i break these apart and calculate the average of these three numbers and set the average to that particular date. So when a user selects that date from a dropdown box the average should be displayed.
I am just soo Lost and I just want someone to explain to me the code and just a starting tip.
I believe you know about loops right? while,do while and for. Now in this example you are splitting the variable line and storing it in the array data. The for loop iterates through the data array and prints the elements.
Joined: Apr 26, 2012
Oh Okay I understand. But with what are we saying that this my line is being splitted into three parts, I mean the date as one part and the other three numbers as other parts. Also when I Run this I get