import java.io.*; class Students4 { // Read a number of Student records from a file, store them in an array // Filter out those whose average mark is below an input figure static final int MAXSTUDENTS=100; static final int MAXMARKS=30; public static void main(String[] args) throws IOException { String filename; Student [] data; int count=0; double passMark; BufferedReader in = Text.open(System.in),inFile; for(;;) try { System.out.print("\nEnter file name to read from: "); filename=Text.readString(in); inFile=Text.open(filename); break; } catch(FileNotFoundException e) { System.out.println("No file of that name found"); } data = new Student[MAXSTUDENTS]; try { for(;;) try { data[count++] = Student.read(inFile); } catch(PersonException e) { System.out.println(e.getMessage()); count--; } } catch(IOException e) { } catch(ArrayIndexOutOfBoundsException e) { System.out.print("Maximum number of students ("+MAXSTUDENTS); System.out.println(") exceeded"); } count--; System.out.println("\nThe records are:\n"); for(int i=0;i