title: Reading A Pair Of Numbers On A Line In A File
body: <p>I am currently working on a program that gets a user inputted file, adds the two numbers on each line, and out prints the answer into a user-made output file AND the run screen in Netbeans. I seem to only be able to do the first line, and, when printing, the second number in the line doesn't even show. </p>
  
  <p>Code:­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ </p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import java.io.PrintWriter;
  import java.util.Scanner;
  
  public class Sums {
  
      public static void main(String[] args) throws IOException {
  
          // Scanner for user input
          Scanner user = new Scanner(System.in);
          String inputFileName, outputFileName;
  
          // prepare the input file
          System.out.print("Input File Name: ");
          inputFileName = user.nextLine().trim();
          File input = new File(inputFileName);
          Scanner scan = new Scanner(input);
  
          // prepare the output file
          System.out.print("Output File Name: ");
          outputFileName = user.nextLine().trim();
          // processing loop
          try (PrintWriter output = new PrintWriter(outputFileName)) {
              // processing loop
              {
                  while (scan.hasNext()) {
                      int Numbers = scan.nextInt();
                      double sum = 0;
  
                      for (int i = 0; i &lt; Numbers; i++) {
                          sum += scan.nextDouble();
                      }
  
                      double total = (((sum + 1) * sum) / (2));
  
                      output.println("Sum From " + Numbers + "To " + Numbers + "is " + total);
  
                  }
              }
          }
      }
  
  }
  </code></pre>