title: Reading and splitting the integers from a text file to add together?
body: <p>How do i split a text file ?</p>
  
  <p>say a text file had lines like this :</p>
  
  <p>Jekyll 23.3 33.3 43.2</p>
  
  <p>khaki   32.5 54.3 43.2</p>
  
  <p>.....</p>
  
  <p>so far for my code i have this :</p>
  
  <pre><code>while(scan.hasNext())
       {
  
            String line = scan.nextLine(); 
            String[] words = .split(" ");
  
            for(int i = 1; i &lt; words.length - 1; i++)
                System.out.println(words[i]);
  </code></pre>
  
  <p>edit</p>
  
  <p>now this is printed, my goal is to add all the numbers togeather and then create an average, Im stuck on what needs to be done here</p>
  
  <p>edit entire code:</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.File;
  import java.io.IOException;
  import java.text.DecimalFormat;
  
  public class TemperaturesWeek2
  {
      public static void main( String [] args ) throws IOException
      {
          int count=0;
          double averageTemp;
          int averageAbove;
          double highestAverage;
  
          File inputFile = new File (
                           "C:/Users/Phillip/Documents/Temp/temperatures.txt .txt");
          Scanner scan = new Scanner(inputFile);
  
          while(scan.hasNext()) {
  
              String words = scan.next();
  
              double num1 = scan.nextDouble();
              double num2 = scan.nextDouble();
              double num3 = scan.nextDouble();
              double num4 = scan.nextDouble();
              double num5 = scan.nextDouble();
              double num6 = scan.nextDouble();
              double num7 = scan.nextDouble();
  
              double average = (num1 + num2 + num3+ num4+ num5+ num6+ num7) / 7;
  
              System.out.println(words);
              System.out.println("average is : " + average);
          } 
      }
  }
  }
  </code></pre>