import java.io.*; class People4 { // Read a number of Person records from a file, store them in an array // Sort them by name. static final int MAXPEOPLE=100; public static void main(String[] args) throws IOException { String filename; Person [] data; int count=0; 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 Person[MAXPEOPLE]; try { for(;;) try { data[count++] = readPerson(inFile); } catch(PersonException e) { System.out.println(e.getMessage()); count--; } } catch(IOException e) { } catch(ArrayIndexOutOfBoundsException e) { System.out.print("Maximum number of people ("+MAXPEOPLE); System.out.println(") exceeded"); } count--; PeopleSorter sorter = new PeopleSorter(new PeopleOrderByName()); System.out.println("\nThe records (sorted by name) are:\n"); sorter.sort(data,count); for(int i=0;i