//Type in the number of lists, the type in a list of numbers and it will give you the average.
//The list of numbers must be in the form of number1 <return> number2 <return> etc. End the list with -1
//by www.neiljohan.com

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;


public class ListAverage
{
   public static void main(String[] pArgs) throws IOException
   {

       
       double tTotal=0;
       double tAverage=0;
       int tNumberOfItems=0;
       
       int tLoops = NeilClass.GetInputInt("How many lists do you want to type in ");

       for (int counter=0; counter <tLoops; counter++){

           double tNumber = 0;
           
           
           while (tNumber != -1) {

                tNumber = NeilClass.GetInputDouble("");
                if (tNumber == -1){
                    tAverage = tTotal/tNumberOfItems;
                    System.out.println("The average of the last list is " + tAverage);
                    tAverage = 0;
                    tNumberOfItems=0;
                    tTotal=0;
                                        
                    break;
                }

                          
               tTotal=tTotal + tNumber;
               tNumberOfItems++;
               
           
           }
       }
       

   }
}


