// // Example of // - class with methods // - using arrays // - command line argument // - reading a file // - new for statement (see mean) // - Array.sort // - statistics // import java.io.*; import java.util.*; /** A data set of integers read from file @author Patrick Prosser @ version 1.0 */ public class DataSet { private int n; private int[] data; /** create a data set from file, where 1st entry in file is number of numbers in the file @param fname is the name of the file */ public DataSet(String fname) throws IOException { Scanner sc = new Scanner(new File(fname)); n = sc.nextInt(); data = new int[n]; for (int i=0;i