title: Read txt file into array then find min max and average of salaries
body: <p>Looks like this is the week for this type of question. And after reading through all of the new ones and several old ones, I'm no less confused!</p>
  
  <p>I have a text file with 5 employees, each having 10 salary values listed beneath their name. I am to read in this file, find and display the employee Name, minimum salary, maximum salary and the average salary for each person. I must have 3 loops: One to control reading the file, one to lad the data into the array, and one to do the calculations. I have to print the information for each person on one line, and i must allow decimals rounded to 2 decimal places apparently using <code>Math.round</code> which I've never heard of!</p>
  
  <p>I am embarrassed to show you the mess of code I have because it's not much, but I don't know after reading all that I have if I've even started correctly.  I do not know if I have even the right idea of how to proceed.  Your help is appreciated.</p>
  
  <p><strong>UPDATED CODE:</strong> AGAIN!  </p>
  
  <pre><code>    import javax.swing.*;
  import java.io.*;
  public class MinMaxSalary3
  {
      public static void main(String args[])throws Exception
      {
          // Declare input file to be opened.
          FileReader fr = new FileReader ("salary.dat");
          BufferedReader br = new BufferedReader (fr);
          //General Declarations
          final String TITLE = "Employee's Salary Report";
          String employeeName, salaryString;
          double avgSalary=0.0;
          double totalSalary = 0.0;
          double sum = 0.0; 
          // Declare Named Constant for Array.
          final int MAX_SAL = 10;     
          // Declare array here.
          int salary[] = new int[MAX_SAL];
  
           System.out.println (TITLE);
              while ((employeeName = br.readLine()) != null)
              {
                 System.out.print ("" + employeeName);
  
  
          // Use this integer variable as your loop index.
                  int loopIndex;                  
          // Assign the first element in the array to be the minimum and the maximum.
                  double minSalary = salary[1];
                 double maxSalary = salary[1]; 
          // Start out your total with the value of the first element in the array.
                  sum = salary[1]; 
              // Write a loop here to access array values starting with number[1]
                  for (loopIndex = 1; loopIndex &lt; MAX_SAL ;loopIndex++)
          // Within the loop test for minimum and maximum salaries.
                  {
                      if  (salary[loopIndex] &lt; minSalary)
                      {
                          minSalary = salary[loopIndex];
  
                     if (salary[loopIndex] &gt; maxSalary)
  
                      maxSalary = salary[loopIndex];
  
  
                      }   
  
                          {
              // Also accumulate a total of all salaries.
                         sum += sum; 
            // Calculate the average of the 10 salaries.
                              avgSalary = sum/MAX_SAL;
                          }
              //  I know I need to close the files, and end the while loop and any other loops. I just can't think that far right now. 
              }
              {
          // Print the maximum salary, minimum salary, and average salary.
              System.out.println ("Max Salary" + maxSalary);  
              System.out.println ("Min Salary" + minSalary); 
              System.out.println ("Avg Salary" + avgSalary); 
              }
  
  
          System.exit(0);
      }
    }
  }
  </code></pre>