/**
 * Test program to verify the new AddressBook and Person classes
 * from Chapter 10.
 */

class TestAddressBookSorting
{
    
    public static void main( String[] agr )
    {
        
        Person p;
        
        AddressBook ab = new AddressBook( );
        
        p = new Person( "Jon", 15 , 'M' );
        ab.add( p );
        
        p = new Person( "Jane", 17 , 'M' );
        ab.add( p );
        
        p = new Person( "Jill", 20 , 'M' );
        ab.add( p );
        
        p = new Person( "Jim", 12 , 'M' );
        ab.add( p );
        
        p = new Person( "Jack", 10 , 'M' );
        ab.add( p );
        
        Person[] sortedlist = ab.sort( Person.AGE );
        
        for (int i = 0; i < sortedlist.length; i++) {
            System.out.println( sortedlist[i].toString( ) );
        }
        
        System.out.println(" ");
        
        sortedlist = ab.sort( Person.NAME );
        
        for (int i = 0; i < sortedlist.length; i++) {
            System.out.println( sortedlist[i].toString( ) );
        }
    }
}