title: How do I pull information form a .txt file in Java?
body: <p>I currently have some code that can take console input, but I need to make it recognize a list of names and test scores.
  Code that I currently have:</p>
  
  <pre><code>import java.io.*;
  import utils.io.*;
  
  class student
  {
     String name;
     double sResult[];
     int result;
     double sum;
  
     void getdata()
     {
        System.out.println("Enter name:");
        Name = (string) system.in.read();
        int index=0;
  
        for (int counter=1; counter&lt;=5; counter++)
        {
           System.out.println("Enter result for subject"+counter+":");
           sResult[count] = (double) system.in.read();
        }
     }
  
     public static void CalculateAverage()
     {
        sum = 0;
        for (int i=1;i&lt;=5;i++)
        {
           sum += sResult[i];
        }
        return (int) Math.round(sum/(values.length-1));
     }
  
     Public static char calculateGrade()
     {
        result=sum;
        if (result&gt;=0 &amp;&amp; result &lt;=59)
        {
           return ('F');
        }
        else
        if (result &gt;=60 &amp;&amp; result&lt;=69)
        {
           return ('E');
        }
        else
        if (result&gt;=0 &amp;&amp; result&lt;79)
        {
           return ('D');
        }
        else
        if (result &gt;=70 &amp;&amp; result&lt;=79)
        {
           return ('C');
        }
        else
        if (result&gt;=80 &amp;&amp; result&lt;=89)
        {
           return ('B');
        }
        else
        if (result&gt;=90 &amp;&amp; result&lt;=100)
        {
           return ('A');
        }
     }
  }
  </code></pre>
  
  <p>and class test</p>
  
  <pre><code>public class test
  {
     public static void main(String[] args)
  {
     Student std;
     do
     {
        std=new Student();
        std.getdata();
        System.out.println("Student Name:"+std.Name);
        System.out.println("Average for"+std.Name+" "+"is:"+std.average());
        System.out.println("Grade for"+std.Name+" "+"is:"+std.gradecal());
        System.out.println("Want to continue (1-Yes,2-No");
     }
     while(System.in.read()==1);
  }
  </code></pre>
  
  <p>The text document format is name score1 score2 score3 score4 score5</p>
  
  <p>I only need help figuring out how to import the values, and then I can probably figure out how to rewrite the .txt using PrintWriter.</p>
  
  <p>Thanks in advance for any help!</p>