/**
 * The Arraying class implements an application that
 * initialises randomly an int array of random size,
 * and then computes its average.
 */


class Arraying
  {
    // -------------- constants --------------------------------
    final static int SIZE = (int) (24 * Math.random());

    // -------------- the MAIN method --------------------------
    public static void main(String [] args) 
      {
        int [] things = new int[SIZE];                 // declaring the array
        int total = 0;
    
        for(int i=0; i<things.length; i++)             // initialising the array randomly
          things[i] = (int) (Math.random() * 1000);

        System.out.println("Our array has the following numbers in it:");
        for(int i=0; i<things.length; i++)
          System.out.print(things[i] + "   ");
        System.out.println();
   
        for(int i=0; i<things.length; i++)             // summing the array
          { 
            total = total + things[i];
          }
        double avg = (double) total / things.length;

        System.out.println("Our array totals to " + total + " with average " + avg);
      }
  } // end of class Arraying