Add method

profilemonicali
statedata.zip

stateData/build.xml

Builds, tests, and runs the project stateData.

stateData/manifest.mf

Manifest-Version: 1.0 X-COMMENT: Main-Class will be added automatically by build

stateData/nbproject/build-impl.xml

Must set src.dir Must set test.src.dir Must set build.dir Must set dist.dir Must set build.classes.dir Must set dist.javadoc.dir Must set build.test.classes.dir Must set build.test.results.dir Must set build.classes.excludes Must set dist.jar Must set javac.includes No tests executed. Must set JVM to use for profiling in profiler.info.jvm Must set profiler agent JVM arguments in profiler.info.jvmargs.agent Must select some files in the IDE or set javac.includes To run this application from the command line without Ant, try: java -jar "${dist.jar.resolved}" Must select one file in the IDE or set run.class Must select one file in the IDE or set run.class Must select one file in the IDE or set debug.class Must select one file in the IDE or set debug.class Must set fix.includes This target only works when run from inside the NetBeans IDE. Must select one file in the IDE or set profile.class This target only works when run from inside the NetBeans IDE. This target only works when run from inside the NetBeans IDE. This target only works when run from inside the NetBeans IDE. Must select one file in the IDE or set run.class Must select some files in the IDE or set test.includes Must select one file in the IDE or set run.class Must select one file in the IDE or set applet.url Must select some files in the IDE or set javac.includes Some tests failed; see details above. Must select some files in the IDE or set test.includes Some tests failed; see details above. Must select some files in the IDE or set test.class Must select some method in the IDE or set test.method Some tests failed; see details above. Must select one file in the IDE or set test.class Must select one file in the IDE or set test.class Must select some method in the IDE or set test.method Must select one file in the IDE or set applet.url Must select one file in the IDE or set applet.url

stateData/nbproject/genfiles.properties

build.xml.data.CRC32=c7b580eb build.xml.script.CRC32=625ef398 [email protected] # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=c7b580eb nbproject/build-impl.xml.script.CRC32=7013d572 nbproject/[email protected]

stateData/nbproject/project.properties

annotation.processing.enabled=true annotation.processing.enabled.in.editor=false annotation.processing.processor.options= annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output build.classes.dir=${build.dir}/classes build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.dir=${build.dir}/generated build.generated.sources.dir=${build.dir}/generated-sources # Only compile against the classpath explicitly listed here: build.sysclasspath=ignore build.test.classes.dir=${build.dir}/test/classes build.test.results.dir=${build.dir}/test/results # Uncomment to specify the preferred debugger connection transport: #debug.transport=dt_socket debug.classpath=\ ${run.classpath} debug.test.classpath=\ ${run.test.classpath} # Files in build.classes.dir which should be excluded from distribution jar dist.archive.excludes= # This directory is removed when the project is cleaned: dist.dir=dist dist.jar=${dist.dir}/stateData.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= includes=** jar.compress=false javac.classpath= # Space-separated list of extra javac options javac.compilerargs= javac.deprecation=false javac.external.vm=true javac.processorpath=\ ${javac.classpath} javac.source=1.8 javac.target=1.8 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} javac.test.processorpath=\ ${javac.test.classpath} javadoc.additionalparam= javadoc.author=false javadoc.encoding=${source.encoding} javadoc.noindex=false javadoc.nonavbar=false javadoc.notree=false javadoc.private=false javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= main.class=statedata.stateList manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false platform.active=default_platform run.classpath=\ ${javac.classpath}:\ ${build.classes.dir} # Space-separated list of JVM arguments used when running the project. # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. # To set system properties for unit tests define test-sys-prop.name=value: run.jvmargs= run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 src.dir=src test.src.dir=test

stateData/nbproject/project.xml

org.netbeans.modules.java.j2seproject stateData

stateData/src/statedata/arrayClass.java

stateData/src/statedata/arrayClass.java

package  statedata ;

import  java . io . File ;
import  java . io . FileNotFoundException ;
import  java . util . Scanner ;

public   class  arrayClass  {

     private  stateClass []  myList ;
     private   int  count ;

     public   void  readData ()   throws   FileNotFoundException   {

         // set the array and size
        myList  =   new  stateClass [ 100 ];

         // import text data
         File  stateData  =   new   File ( "statedata.txt" );

         // set up the scanner 
         Scanner  kb  =   new   Scanner ( stateData );

         // create a while loop to store the data in array   
         while   ( kb . hasNextLine ())   {
            myList [ count ]   =   new  stateClass ( kb );
            count ++ ;
           
         }   // end while
        
     }    // end readData()
    
}   // arrayClass

stateData/src/statedata/stateClass.java

stateData/src/statedata/stateClass.java

package  statedata ;

import  java . util . Scanner ;

public   class  stateClass  {
     // declare the variables
     private   String  isState ;     // properiy of state name
     private   String  isCapital ;   // property of capital name
     private   int  isPopulation ;   // property of population

     public  stateClass ()   {

     }

     public  stateClass ( String  state ,   String  capital ,   int  population )  
     {
        isState  =  state ;     
        isCapital  =  capital ;
        isPopulation  =  population ;
     }     // end stateClass(String state, String capital, int population)

     public  stateClass ( Scanner  scanner )  
     {
        isState  =  scanner . nextLine ();
        isCapital  =  scanner . nextLine ();
        isPopulation  =  scanner . nextInt ();
        scanner . nextLine ();
     }     // stateClass(Scanner scanner)

     public   String  getState ()  
     {
         return  isState ;
     }     // end getState()

     public   String  getCapital ()  
     {
         return  isCapital ;
     }     // end getCapital()

     public   int  getPopulation ()  
     {
         return  isPopulation ;
     }     // end getPopulation()

     public   void  setState ( String  state )  
     {
        isState  =  state ;
     }     // end setState()

     public   void  setCapital ( String  capital )  
     {
        isCapital  =  capital ;
     }     // end setCapital()

     public   void  setPopulation ( int  population )  
     {     
        isPopulation  =  population ;
     }     // end setPopulation()

     public   String  toString ()   {
         return   ( isState  +   " "   +  isCapital  +   " "   +  isPopulation );
     }     // end toString()
}

stateData/src/statedata/stateList.java

stateData/src/statedata/stateList.java

/* @author 
 *  
 * last edited 1/24/17
 * Week 1 - Programming Assignment 
 */

package  statedata ;

import  java . io . FileNotFoundException ;
import  java . util . Scanner ;

public   class  stateList  {

     public   static   void  main ( String []  args )   throws   FileNotFoundException   {
         String  state ;   // name of the states
        
         // set up scanner
         Scanner  kb  =   new   Scanner ( System . in );
        
         // ask user to enter the name of the state
         System . out . println ( "Please enter the name of the state: " );
        state  =  kb . nextLine ();
        
         // call stateClass() method and pass
        arrayClass array  =   new  arrayClass ();
        
        array . readData ();
     }   
}  

stateData/statedata.txt

Alabama Montgomery 4858979 Alaska Juneau 738432 Arizona Phoenix 6828065 Arkansas Little Rock 2978204 California Sacramento 39144818 Colorado Denver 5456574 Connecticut Hartford 3590886 Delaware Dover 945934 Florida Tallahassee 20271272 Georgia Atlanta 10214860 Hawaii Honolulu 1431603 Idaho Boise 1654930 Illinois Springfield 12859995 Indiana Indianapolis 6619680 Iowa Des Moines 3123899 Kansas Topeka 2911641 Kentucky Frankfort 4425092 Louisiana Baton Rouge 4670724 Maine Augusta 1329328 Maryland Annapolis 6006401 Massachusetts Boston 6794422 Michigan Lansing 9922576 Minnesota Saint Paul 5489594 Mississippi Jackson 2992333 Missouri Jefferson City 6083672 Montana Helena 1032949 Nebraska Lincoln 1896190 Nevada Carson City 2890845 New Hampshire Concord 1330608 New Jersey Trenton 8958013 New Mexico Santa Fe 2085109 New York Albany 19795791 North Carolina Raleigh 10042802 North Dakota Bismarck 756927 Ohio Columbus 11613423 Oklahoma Oklahoma City 3911338 Oregon Salem 4028977 Pennsylvania Harrisburg 12802503 Rhode Island Providence 1056298 South Carolina Columbia 4896146 South Dakota Pierre 858469 Tennessee Nashville 6600299 Texas Austin 27469114 Utah Salt Lake City 2995919 Vermont Montpelier 626042 Virginia Richmond 8382993 Washington Olympia 7170351 West Virginia Charleston 1844128 Wisconsin Madison 5771337 Wyoming Cheyenne 586107