:Write a class with a constructor that accepts a file name as its argument. assume the file contains a series of numbers, each written on a sepeate line. the class should read the contents of the file into an array, and then displays the followin data: lowest number in the array, highest number in the array, total of the numbers, average of the numbers. When I leave getHighestNumber(), getLowestNumber(), etc blank my numbers data isnt transfered to the other methods, but when I apply (double numbers) I get an error that double cannot be dereferenced, any help?

public class NumberAnalysis { public static void main(String[] args) { double[] numbers; numbers = getArray(); } /** getArray method @return A reference to an array of doubles read f. */ public static double[] getArray() { final int SIZE = 12; double[] numbers = new double[SIZE]; int index = 0; File file = new File("Numbers.txt"); Scanner inputFile = new Scanner(file); while (inputFile.hasNext() && index < numbers.length) { numbers[index] = inputFile.nextInt(); index++; } inputFile.close(); return numbers; } /** getLowest method @return the lowest value in the array */ public double getLowestNumber(double numbers) { double lowest; lowest = numbers[0]; for (int index = 1; index < numbers.length; index++) { if (numbers[index] < lowest) lowest = numbers[index]; } return lowest; } /** getHighest method @return The highest value stored in the array */ public double getHighestNumber(double numbers) { double highest; highest = numbers[0]; for (int index = 1; index < numbers.length; index++) { if (sales[index] > highest) highest = numbers[index]; } return highest; } /** getTotal @return the total of all the elements in the stored array */ public double getTotal(double numbers) { double total = 0.0; for (int index = 0; index < numbers.length; index++) total += numbers[index]; return total; } /** getAverage @return the average of all the elements in the stored array */ public double getAverage(double numbers) { return getTotal() / numbers.length; } }

This post has been edited by **smohd**: 06 December 2011 - 08:32 PM

Reason for edit:: Code tags added. Please use [code] tags when posting codes