logo

Array Searches and Sorts

   

Added on  2019-09-27

5 Pages1636 Words280 Views
 | 
 | 
 | 
COP3538 Project 1 – Array Searches and SortsLiuUniversityofNorthFlorida1Due Date:Friday, 5/31/2019 11:59 PMSubmitthezippedEclipseprogramincludingatleastProject1.java,State.javaandStates.csv.Thezipfileshouldbenamed<yourlastname>_Project1.zip(forexample,Liu_Project1.zip).TheStates.csvfilecontainsinformationaboutall50statesintheUSplusWashingtonDCandfiveterritories.Intotal,thereare56recordsinthisfile.Weshallcallalltheseplacesstatesforourprojects.TheprogramshouldbewelldocumentedintheformatofdoccommentsinJava.Detailedformatsarefoundathttp://www.oracle.com/technetwork/articles/java/index-137868.html.Requirements: 1.Create a class named Statethat will store information about a state and provide methods to get, and set the data, and compare the states by several fields. a.Fields: Name, Capital City, Abbreviation, Population, Region, US House Seats b.Constructor c.Get and set methods for each field d.Compare method to compare State objects based on Name string (expects a State object as a parameter) e.Method to print a state 2.Create a class named Project1that will: a.Read a file (csv) of states and create an array of state objects containing that data. b.Offer the user the following options: 1)Print a state report 2)Sort by state name (using Bubble sort) 3)Sort by population (using Selection sort) 4)Sort by capital city (using Insertion sort) 5)Find and print a state given the capital city (using binary search if the data is sorted by capital city, sequential search if not) 6)Quit c.Implement the given option, then prompt again. (deal with invalid choice) Project1 should have main and methods for each options 1-5. d.The State report in option 1 should be in this form: Name Capital City Abbr Population Region US House Seats ------------------------------------------------------------------------------------------ Florida Tallahassee FL 19552860 South 27 Pennsylvania Harrisburg PA 12773801 Middle Atlantic 18 Massachusetts Boston MA 6692824 New England 9 e.The State report in option 5 should be in this form: Name: Florida Capital City: Tallahassee Abbr: FL Population: 19,552,860 Region: South
Array Searches and Sorts_1

COP3538 Project 1 – Array Searches and SortsLiuUniversityofNorthFlorida2US House Seats: 27 Provide comments in this form for the State class: Commentsfortheclass:/** * Detailed description of the class. * * @author <your name> * @version <date you last changed the class>*/ Publicmethodcomments:/** * Description of the purpose of the method, the meaning of the * input parameters (if any) and the meaning of the return values * (if any). * * @param parameter description of the parameter (one for each) * @return description of the return value */ Provide comments in this form for the Project1 class. Commentsfortheclass:/** * COP 3538: Project 1 – Array Searches and Sorts * <p> * Description of the class using as many lines as needed * with <p> between paragraphs. Including descriptions of the * input required and output generated. * * @author <your name> *@version <the date you last modified the program>*/ public class Project1 { Publicmethodcomments:/** * Description of the purpose of the method, the meaning of the * input parameters (if any) and the meaning of the return values * (if any). * * @param parameter description of the parameter (one for each) * @return description of the return value */
Array Searches and Sorts_2

End of preview

Want to access all the pages? Upload your documents or become a member.