new java assignment

profilekami_se012013
java6.zip

Java6/Assign6-S2013.docx

CS204

Myers

Assignment 6

Spring 2013

The US Census has the primary job of providing population information used to determine how many seats each state is given in the House of Representatives. Beyond this, the Census provides data for researchers to study trends in the lives and lifestyles of Americans.

We will be using data that comes from the 2000 US Census. The file NE_counties.csv contains population data for counties in the New England states. Write an application that implements the bubble sort, merge sort, quick sort and heap sort algorithms, and allows sorting in three ways, using different Comparator objects:

· Alphabetical by County name.

· Reverse order by population.

· Alphabetical by state name then reverse order by population

Your application will display the time for each sort and a listing of the results.

Data Element - County

You will be creating a class County which will hold all the information for a county: name, state and population. Include getters and setters. Override the equals method for the JUnit test. Implement Serialization so it can be written to a binary file with an ObjectOutputStream. Provide the constructor County(String name, String state, int population) for the JUnit test.

Data Structure – County[]

Data Manager – CountyList

Create a class CountyList. Implement the CountyListInterface. There will be methods for reading from a text file, reading from a binary , writing to a binary file and to add a county. There is also a method called randomOrder to randomize the order of the County objects for testing the sort routines.

Utility – SortUtility

Create a class SortUtility that follows the javadoc I have given you. It is a generic class of static methods. You will have methods for bubbleSort, heapSort, mergeSort, quicksort and a method compareSorts which returns an Map<String, Pair<Long, County[]>>, which is a map of Strings (The names of the sorts “Merge”, “Bubble”, etc.) and Pair<Long, County[]> objects which contains a long with the nanoSeconds required to execute the sort and an array of County which is the results of the sort. Make sure each sort is using the same initial unsorted array of County objects. System.nanoTime() returns nanoseconds.

Utility – Pair

I have given you the code for this class. The SortUtility compareSorts method uses it .

Comparators – CountyNameComparator, PopulationComparator, StatePopComparator

The classes implement the Comparator interface and give a definition for the compare and equals methods. CountyNameComparator will compare the County objects by County names in alpha order. PopulationComparator will compare the County objects by population in reverse order (largest first). StatePopComparator will compare the County objects by State in alpha order and then population in reverse order (largest first).

GUI Driver

Use an object of your CountyList. Use the FileChooser to ask the user for the location of the file to read the county information. The results of each sort is displayed . Provide a way for the user to select between the way the county information is sorted (by county name, by reverse population, by state and then reverse population.

Input File

The county information is stored in a .csv (comma separated values) file in the following format (fields separated by a ,):

<county name>,<state>,<population><new line>

Here is a portion of the file:

Exception Handling

Display appropriate messages to user when an exception is raised while attempting to read a file.

Read from the text file

Sort by population (reverse order)

Program Grade Sheet

Assignment #6

CS204

Name _________________________________ Date/Time _________________

DOCUMENTATION

Javadoc for user created classes: 4 pt _____

Test Cases 4 pt _____

JUnit Test Class

Implement the student tests in CountyListTest and

SortUtilityTest

UML Diagram 2 pt _____

PROGRAMMING

Programming Style

Internal class documentation (within source code) 3 pt _____

Class description using Javadoc

Author’s Name, Class, Class Time

Methods commented using Javadoc

Program user interface

Clear to user how data is to be entered 1 pt _____

Output is easy to understand 1 pt _____

Accuracy

Public Tests – provided for you and the ones you wrote 5 pt _____

Private Tests 5 pt _____

Program Details

1. Data Element – County class 4 pt _____

a. Implements Serializable

b. toString, getters & setters methods

2. Data Manager – CountyList 7 pts _____

a. Implements the CountyListInterface

b. Uses data structure of County[]

c. Methods that read from text and binary files

d. Method write to binary file

3. Comparators – CountyNameComparator, PopulationComparator, 5 pts _____

StatePopComparator

a. Definitions for compare and equals methods

b. Compare() works correctly for type of comparator it is

4. Utility – SortUtility class 5 pts _____

a. Correctly implements methods for mergeSort, bubbleSort

quickSort and heapSort

b. Generic class

c. Follow javadoc provided

d. Uses comparators

5. GUI 4 pts _____

a. Uses fileChooser to get file names

b. Displays results of all sorts

c. Uses methods of SortUtility

d. Display appropriate error messages

Total 50 pt _____

image2.png

image3.png

image4.png

image1.png

Java6/Java6/.classpath

Java6/Java6/.project

Java6 org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature

Java6/Java6/.settings/org.eclipse.jdt.core.prefs

eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6

Java6/Java6/bin/Assignment6/CountyListInterface.class

                package Assignment6;

                abstract 
                interface CountyListInterface {
    
                static void 
                <clinit>();
    
                public 
                abstract void 
                add(County);
    
                public 
                abstract String 
                readBinaryFile(java.io.File);
    
                public 
                abstract String 
                readTextFile(java.io.File);
    
                public 
                abstract String 
                writeBinaryFile(java.io.File);
    
                public 
                abstract County[] 
                getList();
}

            

Java6/Java6/bin/Assignment6/CountyListTest.class

                package Assignment6;

                public 
                synchronized 
                class CountyListTest {
    CountyList 
                countyListGroup1;
    CountyList 
                countyListGroup2;
    County[] 
                countiesGroup1;
    County[] 
                countiesGroup2;
    County 
                county1;
    County 
                county2;
    County 
                county3;
    County 
                county4;
    County 
                county5;
    County 
                county6;
    County 
                county7;
    County 
                county8;
    County 
                county9;
    County 
                county10;
    
                static java.io.File 
                selectedTextFile;
    
                public void CountyListTest();
    
                public 
                static void 
                setUpBeforeClass() 
                throws Exception;
    
                public void 
                setUp() 
                throws Exception;
    
                public void 
                tearDown() 
                throws Exception;
    
                public void 
                testReadTextFile();
    
                public void 
                testReadandWriteBinaryFile();
    
                public void 
                testAdd();
}

            

Java6/Java6/bin/Assignment6/Pair.class

                package Assignment6;

                public 
                synchronized 
                class Pair {
    
                private Object 
                first;
    
                private Object 
                second;
    
                public void Pair(Object, Object);
    
                public Object 
                getFirst();
    
                public Object 
                getSecond();
}

            

Java6/Java6/bin/Assignment6/SortUtilityTest$TestComparatorA.class

                package Assignment6;

                synchronized 
                class SortUtilityTest$TestComparatorA 
                implements java.util.Comparator {
    
                private void SortUtilityTest$TestComparatorA(SortUtilityTest);
    
                public int 
                compare(SortUtilityTest$TestObject, SortUtilityTest$TestObject);
}

            

Java6/Java6/bin/Assignment6/SortUtilityTest$TestObject.class

                package Assignment6;

                synchronized 
                class SortUtilityTest$TestObject {
    
                private String 
                stringField;
    
                private int 
                intField;
    
                private double 
                doubleField;
    
                public void SortUtilityTest$TestObject(SortUtilityTest, String, int, double);
    
                public int 
                getInt();
    
                public String 
                getString();
}

            

Java6/Java6/bin/Assignment6/SortUtilityTest.class

                package Assignment6;

                public 
                synchronized 
                class SortUtilityTest {
    
                private SortUtilityTest$TestObject[] 
                objects;
    
                private SortUtilityTest$TestComparatorA 
                comparator;
    
                public void SortUtilityTest();
    
                public void 
                setUp() 
                throws Exception;
    
                public void 
                tearDown() 
                throws Exception;
    
                public void 
                testHeapSort();
    
                public void 
                testHeapSortSTUDENT();
    
                public void 
                testMergeSort();
    
                public void 
                testQuickSort();
    
                public void 
                testQuickSortSTUDENT();
    
                public void 
                testBubbleSort();
    
                public void 
                testCompareSorts();
}

            

Java6/Java6/src/Assignment6/CountyListInterface.java

Java6/Java6/src/Assignment6/CountyListInterface.java

package   Assignment6 ;
import  java . util . * ;
import  java . io . * ;

import  javax . swing . JFileChooser ;

/**
 * Creates and maintains an array of County objects
 * by reading from a text file.  
 * Writes the array of County objects to a file using'
 * the ObjectOutputStream.  After writing a binary file,
 * it is allowable to read from a binary file using
 * a ObjectInputStream.
 *  @author  Professor Myers
 *  @version  1.0
 */
interface   CountyListInterface   {
  
     /**
     * Adds a county object to the array of County objects.
     * Assume that the array of County objects is always full
     * You must increase the size of the array of County objects by 1
     * and place this new county in at the end;
     *  @param  county the county object to be added to the array of County objects
     */
     public   void  add ( County  county );
    
     /**
     * Read from a binary file with ObjectInputStream and creates
     * an array of County.  Must have called the method writeBinaryFile 
     * on the File before this method is called
     *  @param  selectedFile the binary file to read from
     *  @return  null if the read was successful and no exceptions were raised, 
     * or a string with the type of exception raised, i.e. "ClassNotFoundException"
     *  @exception  catches all exceptions
     */
   public   String  readBinaryFile ( File  selectedFile );  
 
   /**
   * Reads from a .csv text file and creates an array of County.
   *  @param  selectedFile a .csv file
   *  @return  null if the read was successful and no exceptions were raised, 
     * or a string with the type of exception raised, i.e. "IOException"
   *  @exception  catches all exceptions
   */
   public   String  readTextFile ( File  selectedFile );
  

   /**
   * Writes to a binary file with ObjectOutputStream
   *  @param  selectedFile the binary file to write to
   *  @return  null if the read was successful and no exceptions were raised, 
     * or a string with the type of exception raised, i.e. "IOException"
   *  @exception  catches all exceptions
   */
   public   String  writeBinaryFile ( File  selectedFile );
  

   /**
   * Returns an array of county objects in random order.
   *  @return  An array of county objects in random order.
   */
   public   County []  getList ();
}

Java6/Java6/src/Assignment6/CountyListTest.java

Java6/Java6/src/Assignment6/CountyListTest.java

package   Assignment6 ;

import   static  org . junit . Assert . * ;

import  java . io . File ;
import  java . io . IOException ;

import  javax . swing . JFileChooser ;

import  org . junit . After ;
import  org . junit . Before ;
import  org . junit . BeforeClass ;
import  org . junit . Test ;

/**
 * JUnit test for CountyList
 *  @author  Professor Myers
 *
 */
public   class   CountyListTest   {
     CountyList  countyListGroup1 ,  countyListGroup2 ;
     County []  countiesGroup1 ,  countiesGroup2 ;
     County  county1 , county2 , county3 , county4 , county5 ,  county6 ,  county7 ,  county8 ,  county9 ,  county10 ;
     static   File  selectedTextFile  =   null ;
    @ BeforeClass
     public   static   void  setUpBeforeClass ()   throws   Exception
     {
         JFileChooser  chooser  =   new   JFileChooser ();
        chooser . setDialogTitle ( "Select text file" );
         if ( chooser . showOpenDialog ( null )   ==   JFileChooser . APPROVE_OPTION )
         {
            selectedTextFile  =  chooser . getSelectedFile ();
         }
     }

    @ Before
     public   void  setUp ()   throws   Exception   {
        county1  =   new   County ( "Essex County" , "Vermont" , 6459 );
        county2  =   new   County ( "Orleans County" , "Vermont" , 26277 );      
        county3  =   new   County ( "Providence County" , "Rhode Island" , 621602 );
        county4  =   new   County ( "Grand Isle County" , "Vermont" , 6901 );
        county5  =   new   County ( "Hampden County" , "Massachusetts" , 456228 );
        county6  =   new   County ( "Hillsborough County" , "New Hampshire" , 380841 );
        county7  =   new   County ( "Barnstable County" , "Massachusetts" , 222230 );
        county8  =   new   County ( "Norfolk County" , "Massachusetts" , 650308 );
        county9  =   new   County ( "Middlesex County" , "Massachusetts" , 1465396 );
        county10  =   new   County ( "Bennington County" , "Vermont" , 36994 );
        countyListGroup1  =   new   CountyList ();
        countyListGroup2  =   new   CountyList ();
        countyListGroup2 . add ( county1 );
        countyListGroup2 . add ( county2 );
        countyListGroup2 . add ( county3 );
        countyListGroup2 . add ( county4 );
        countyListGroup2 . add ( county5 );
        countyListGroup2 . add ( county6 );
        countyListGroup2 . add ( county7 );
        countyListGroup2 . add ( county8 );
        countyListGroup2 . add ( county9 );
        countyListGroup2 . add ( county10 );

     }

    @ After
     public   void  tearDown ()   throws   Exception   {
        countiesGroup1  =   null ;
        countyListGroup1  =   null ;
     }

    @ Test
     /**
     * make sure all the counties in countiesGroup2 are in countiesGroup1
     */
     public   void  testReadTextFile ()
     {
         int  count  =   0 ;
        countiesGroup2  =  countyListGroup2 . getList ();
         //this array will hold booleans to see if each county in countiesGroup2 was in countiesGroup1
         boolean []  found  =   { false ,   false ,   false ,   false ,   false ,   false ,   false ,   false ,   false ,   false };
        countyListGroup1 . readTextFile ( selectedTextFile );
        countiesGroup1  =  countyListGroup1 . getList ();
         for ( County  b  :  countiesGroup2 )
         {
             for ( County  a  :  countiesGroup1 )
             {
                 if   ( a . equals ( b ))
                    found [ count ++ ] = true ;
             }
         }
         //check if any entries are still false
         for ( int  i = 0 ; i < countiesGroup2 . length ; i ++ )
             if ( found [ i ]   ==   false )
                fail ( "The following county was not found in the array read from the file " + countiesGroup2 [ i ]);
     }

    @ Test
     public   void  testReadandWriteBinaryFile ()   {
         String  result =   null ;
        countiesGroup1  =  countyListGroup2 . getList ();
         int  arrayLength  =  countiesGroup1 . length ;
         JFileChooser  chooser  =   new   JFileChooser ();
        chooser . setDialogTitle ( "Select binary file to save to" );
         if ( chooser . showSaveDialog ( null )   ==   JFileChooser . APPROVE_OPTION )
         {
             File  selectedBinaryFile  =  chooser . getSelectedFile ();
             try {
                result  =  countyListGroup2 . writeBinaryFile ( selectedBinaryFile );
                 if ( result  ==   null )
                 {
                    result  =  countyListGroup2 . readBinaryFile ( selectedBinaryFile );
                     if ( result  ==   null )
                     {
                         int  count = 0 ;
                        countiesGroup2  =  countyListGroup2 . getList ();
                         int  newArrayLength  =  countiesGroup2 . length ;
                        assertEquals ( arrayLength ,  newArrayLength );
                         //this array will hold booleans to see if each county in counties B was in countiesA
                         boolean []  found  =   new   boolean [ countiesGroup2 . length ];
                         //set all elements in found to false
                         for ( boolean  element  :  found )
                            element  =   false ;
                         for ( County  b  :  countiesGroup2 )
                         {
                             for ( County  a  :  countiesGroup1 )
                             {
                                 if   ( a . equals ( b ))
                                    found [ count ++ ] = true ;
                             }
                         }
                         //check if any entries are still false
                         for ( int  i = 0 ; i < countiesGroup2 . length ; i ++ )
                             if ( found [ i ]   ==   false )
                                fail ( "The following county was not found in the array read from the file " + countiesGroup2 [ i ]);
                     }
                     else
                        fail ( result );  
                 }
                 else
                    fail ( result );
             }
             catch   ( Exception  e )
             {
                fail ( "An exception was raised" );
             }
         }
     }

    @ Test
     public   void  testAdd ()
     {
        countiesGroup2  =  countyListGroup2 . getList ();
         int  length  =  countiesGroup2 . length ;
        countyListGroup2 . add ( new   County ( "Androscoggin County" , "Maine" , 103793 ));
        countiesGroup1  =  countyListGroup2 . getList ();
         int  newLength  =  countiesGroup1 . length ;
        assertEquals ( length + 1 , newLength );

     }
}

Java6/Java6/src/Assignment6/Pair.java

Java6/Java6/src/Assignment6/Pair.java

package   Assignment6 ;

/** 
 * Generic class that contains a pair of two objects
 *  @author  Professor Myers
 *
 *  @param  <T> The data type of the first object
 *  @param  <S> The data type of the second object
 */
public   class   Pair < T ,  S >   {
     private  T first ;
     private  S second ;

     /**
     * Constructor
     *  @param  firstElement the first object in the Pair
     *  @param  secondElement the second object in the Pair
     */
     public   Pair ( T firstElement ,  S secondElement )   {  
        first  =  firstElement ;
        second  =  secondElement ;
     }
    
     /**
     * Returns the first object in the Pair
     *  @return  the first object in the Pair
     */
     public  T getFirst ()   {   return  first ;   }  
    
     /**
     * Returns the second object in the Pair
     *  @return  the second object in the Pair
     */
     public  S getSecond ()   {   return  second ;   }
}

Java6/Java6/src/Assignment6/SortUtilityTest.java

Java6/Java6/src/Assignment6/SortUtilityTest.java

package   Assignment6 ;

import   static  org . junit . Assert . * ;

import  java . util . Collection ;
import  java . util . Comparator ;
import  java . util . Map ;

import  org . junit . After ;
import  org . junit . Before ;
import  org . junit . Test ;

/**
 * JUnit test class for SortUtility class
 * STUDENT: 1.  Create another private comparator class for the TestObject class
 *          2.  Use this comparator for the testHeapSortSTUDENT and
 *              testQuickSortSTUDENT methods
 *  @author  Professor Myers
 *
 */
public   class   SortUtilityTest   {
     private   TestObject []  objects ;
     private   TestComparatorA  comparator ;

    @ Before
     public   void  setUp ()   throws   Exception   {
        objects  =   new   TestObject [ 10 ];
        objects [ 0 ]   =   new   TestObject ( "J" ,   1 ,   1.5 );
        objects [ 1 ]   =   new   TestObject ( "A" ,   2 ,   1.5 );
        objects [ 2 ]   =   new   TestObject ( "Q" ,   1 ,   1.5 );
        objects [ 3 ]   =   new   TestObject ( "F" ,   5 ,   1.5 );
        objects [ 4 ]   =   new   TestObject ( "B" ,   1 ,   1.5 );
        objects [ 5 ]   =   new   TestObject ( "K" ,   9 ,   1.5 );
        objects [ 6 ]   =   new   TestObject ( "S" ,   1 ,   1.5 );
        objects [ 7 ]   =   new   TestObject ( "M" ,   9 ,   1.5 );
        objects [ 8 ]   =   new   TestObject ( "Z" ,   1 ,   1.5 );
        objects [ 9 ]   =   new   TestObject ( "T" ,   7 ,   1.5 );
        comparator  =   new   TestComparatorA ();
     }

    @ After
     public   void  tearDown ()   throws   Exception   {
        objects  =   null ;
        comparator  =   null ;
     }

    @ Test
     public   void  testHeapSort ()   {
         SortUtility . heapSort ( objects ,  comparator );
        assertEquals ( "B" ,  objects [ 0 ]. getString ());
        assertEquals ( "J" ,  objects [ 1 ]. getString ());
        assertEquals ( "Q" ,  objects [ 2 ]. getString ());
        assertEquals ( "S" ,  objects [ 3 ]. getString ());
        assertEquals ( "Z" ,  objects [ 4 ]. getString ());
        assertEquals ( "A" ,  objects [ 5 ]. getString ());
        assertEquals ( "F" ,  objects [ 6 ]. getString ());
        assertEquals ( "T" ,  objects [ 7 ]. getString ());
        assertEquals ( "K" ,  objects [ 8 ]. getString ());
        assertEquals ( "M" ,  objects [ 9 ]. getString ());
     }
    
    @ Test
     public   void  testHeapSortSTUDENT ()
     {
        fail ( "Not implemented yet" );
     }

    @ Test
     public   void  testMergeSort ()   {
         SortUtility . mergeSort ( objects ,  comparator );
        assertEquals ( "B" ,  objects [ 0 ]. getString ());
        assertEquals ( "J" ,  objects [ 1 ]. getString ());
        assertEquals ( "Q" ,  objects [ 2 ]. getString ());
        assertEquals ( "S" ,  objects [ 3 ]. getString ());
        assertEquals ( "Z" ,  objects [ 4 ]. getString ());
        assertEquals ( "A" ,  objects [ 5 ]. getString ());
        assertEquals ( "F" ,  objects [ 6 ]. getString ());
        assertEquals ( "T" ,  objects [ 7 ]. getString ());
        assertEquals ( "K" ,  objects [ 8 ]. getString ());
        assertEquals ( "M" ,  objects [ 9 ]. getString ());
     }

    @ Test
     public   void  testQuickSort ()   {
         SortUtility . quickSort ( objects ,  comparator );
        assertEquals ( "B" ,  objects [ 0 ]. getString ());
        assertEquals ( "J" ,  objects [ 1 ]. getString ());
        assertEquals ( "Q" ,  objects [ 2 ]. getString ());
        assertEquals ( "S" ,  objects [ 3 ]. getString ());
        assertEquals ( "Z" ,  objects [ 4 ]. getString ());
        assertEquals ( "A" ,  objects [ 5 ]. getString ());
        assertEquals ( "F" ,  objects [ 6 ]. getString ());
        assertEquals ( "T" ,  objects [ 7 ]. getString ());
        assertEquals ( "K" ,  objects [ 8 ]. getString ());
        assertEquals ( "M" ,  objects [ 9 ]. getString ());
     }

    @ Test
     public   void  testQuickSortSTUDENT ()
     {
        fail ( "Not implemented yet" );
     }
    
    @ Test
     public   void  testBubbleSort ()   {
         SortUtility . bubbleSort ( objects ,  comparator );
        assertEquals ( "B" ,  objects [ 0 ]. getString ());
        assertEquals ( "J" ,  objects [ 1 ]. getString ());
        assertEquals ( "Q" ,  objects [ 2 ]. getString ());
        assertEquals ( "S" ,  objects [ 3 ]. getString ());
        assertEquals ( "Z" ,  objects [ 4 ]. getString ());
        assertEquals ( "A" ,  objects [ 5 ]. getString ());
        assertEquals ( "F" ,  objects [ 6 ]. getString ());
        assertEquals ( "T" ,  objects [ 7 ]. getString ());
        assertEquals ( "K" ,  objects [ 8 ]. getString ());
        assertEquals ( "M" ,  objects [ 9 ]. getString ());
     }

    @ Test
     public   void  testCompareSorts ()   {
         Map < String ,   Pair < Long ,   TestObject [] >>  results ;
        results  =   SortUtility . compareSorts ( objects ,  comparator );
         Collection < Pair < Long ,   TestObject [] >>  values  =  results . values ();
         TestObject []  objs ;
         //test each of the sorts results
         for ( Pair < Long ,   TestObject [] >  element  :  values )
         {
            objs  =  element . getSecond ();
            assertEquals ( "B" ,  objs [ 0 ]. getString ());
            assertEquals ( "J" ,  objs [ 1 ]. getString ());
            assertEquals ( "Q" ,  objs [ 2 ]. getString ());
            assertEquals ( "S" ,  objs [ 3 ]. getString ());
            assertEquals ( "Z" ,  objs [ 4 ]. getString ());
            assertEquals ( "A" ,  objs [ 5 ]. getString ());
            assertEquals ( "F" ,  objs [ 6 ]. getString ());
            assertEquals ( "T" ,  objs [ 7 ]. getString ());
            assertEquals ( "K" ,  objs [ 8 ]. getString ());
            assertEquals ( "M" ,  objs [ 9 ]. getString ());
         }
     }

     private   class   TestComparatorA   implements   Comparator < TestObject >
     {

        @ Override
         public   int  compare ( TestObject  o1 ,   TestObject  o2 )   {
             //order by int and then by string
             if ( o1 . getInt ()   ==  o2 . getInt ())
                 return  o1 . getString (). compareTo ( o2 . getString ());
             else   if ( o1 . getInt ()   >  o2 . getInt ())
                 return   1 ;
             else
                 return   - 1 ;
         }
        
     }
    
     private   class   TestObject
     {
         private   String  stringField ;
         private   int  intField ;
         private   double  doubleField ;
        
         public   TestObject ( String  s ,   int  i ,   double  d )
         {
            stringField  =  s ;
            intField  =  i ;
            doubleField  =  d ;
         }
        
         public   int  getInt ()   {   return  intField ;}
        
         public   String  getString ()   { return  stringField ;}
        
     }
}

Java6/NE_counties.csv

Essex County Vermont 6459
Orleans County Vermont 26277
Providence County Rhode Island 621602
Grand Isle County Vermont 6901
Hampden County Massachusetts 456228
Hillsborough County New Hampshire 380841
Barnstable County Massachusetts 222230
Norfolk County Massachusetts 650308
Middlesex County Massachusetts 1465396
Bennington County Vermont 36994
Androscoggin County Maine 103793
Cheshire County New Hampshire 73825
New Haven County Connecticut 824008
Windsor County Vermont 57418
Bristol County Rhode Island 50648
Essex County Massachusetts 723419
Worcester County Massachusetts 750963
Lincoln County Maine 33616
Piscataquis County Maine 17235
Kent County Rhode Island 167090
Fairfield County Connecticut 882567
Hartford County Connecticut 857183
Kennebec County Maine 117114
Orange County Vermont 28226
Suffolk County Massachusetts 689807
Lamoille County Vermont 23233
Caledonia County Vermont 29702
Rutland County Vermont 63400
Hancock County Maine 51791
Waldo County Maine 36280
Belknap County New Hampshire 56325
Nantucket County Massachusetts 9520
Chittenden County Vermont 146571
Newport County Rhode Island 85433
Sullivan County New Hampshire 40458
Merrimack County New Hampshire 136225
Bristol County Massachusetts 534678
Franklin County Vermont 45417
Grafton County New Hampshire 81743
Penobscot County Maine 144919
Windham County Vermont 44216
Middlesex County Connecticut 155071
Rockingham County New Hampshire 277359
Washington County Maine 33941
York County Maine 186742
Hampshire County Massachusetts 152251
Franklin County Maine 29467
Oxford County Maine 54755
Berkshire County Massachusetts 134953
Franklin County Massachusetts 71535
Strafford County New Hampshire 112233
Addison County Vermont 35974
Sagadahoc County Maine 35214
Windham County Connecticut 109091
Coos County New Hampshire 33111
Litchfield County Connecticut 182193
Cumberland County Maine 265612
Washington County Vermont 58039
Carroll County New Hampshire 43666
Tolland County Connecticut 136364
Knox County Maine 39618
Dukes County Massachusetts 14987
Aroostook County Maine 73938
New London County Connecticut 259088
Washington County Rhode Island 123546
Somerset County Maine 50888
Plymouth County Massachusetts 472822