Homework Solution: Please use comments for each class, methods and constructor…

    I need help with this project: Please use comments for each class, methods and constructor and Thanks. COP3538 Project 1 – Array Searches and Sorts Using JAVA language Due Date: Friday, 9/15/2017 11:59 PM Submit the zipped Eclipse program including at least Project1.java, State.java and States1.csv. The zip file should be named <your last name>_Project1.zip (for example, Liu_Project1.zip). The program should be well documented in the format of doc comments in Java. Detailed formats are found at http://www.oracle.com/technetwork/articles/java/index-137868.html. Requirements: 1. Create a class named State that will store information about a US state and provide methods to get, and set the data, and compare the states by several fields. a. Fields: State Name, Capital City, State Abbreviation, State Population, Region, US House Seats b. Constructor c. Get and set methods for each field d. Compare method to compare based on State Name (expects a State object as a parameter) e. Method to print a state 2. Create a class named Project1 that will: a. Read the 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 Region (using Insertion sort) 5) Find and print a given state (using binary search if the data is sorted by state name, 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: State Name Capital City State Abbr State Population Region US House Seats ------------------------------------------------------------------------------------------ Florida Tallahassee FL 19,552,860 South 27 Pennsylvania Harrisburg PA 12,773,801 Middle Atlantic 18 Massachusetts Boston MA 6,692,824 New England 9 e. The State report in option 5 should be in this form: State Name: Florida Capital City: Tallahassee State Abbr: FL State Population: 19,552,860 Region: South US House Seats: 27 Provide comments in this form for the State class: COP3538 Project 1 – Array Searches and Sorts Liu University of North Florida 2 Comments for the class: /** * Detailed description of the class. * * @author <your name> * @version <date you last changed the class> */ Public method comments: /** * 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. Comments for the class: /** * 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 { Public method comments: /** * 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 */ COP3538 Project 1 – Array Searches and Sorts Liu University of North Florida 3 Output Example: COP3538 Project 1 Instructor: Xudong Liu Array Searches and Sorts Enter the file name: States1.csv There were 50 state records read. 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 1 State Name Capital City State Abbr State Population Region US House Seats ------------------------------------------------------------------------------------------ Mississippi Jackson MS 2,991,207 South 4 New Hampshire Concord NH 1,323,459 New England 2 Pennsylvania Harrisburg PA 12,773,801 Middle Atlantic 18 . . . 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 3 States sorted by Population. 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 1 State Name Capital City State Abbr State Population Region US House Seats ------------------------------------------------------------------------------------------ Wyoming Cheyenne WY 582,658 West 1 Vermont Montpelier VT 626,630 New England 1 North Dakota Bismarck ND 723,393 Midwest 1 . . . COP3538 Project 1 – Array Searches and Sorts Liu University of North Florida 4 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 5 Enter the state name: Florida Sequential search State Name: Florida Capital City: Tallahassee State Abbr: FL State Population: 19,552,860 Region: South US House Seats: 27 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 5 Enter the state name: Canada Sequential search Error: State Canada not found 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 2 States sorted by State name. 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 1 State Name Capital City State Abbr State Population Region US House Seats ------------------------------------------------------------------------------------------ COP3538 Project 1 – Array Searches and Sorts Liu University of North Florida 5 Alabama Montgomery AL 4,833,722 South 7 Alaska Juno AK 735,132 West 1 Arizona Phoenix AZ 6,626,624 Southwest 9 . . . 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 5 Enter the state name: Kentucky Binary search State Name: Kentucky Capital City: Frankfort State Abbr: KY State Population: 4,395,295 Region: South US House Seats: 6 1. Print a state report 2. Sort by State name 3. Sort by Population 4. Sort by Region 5. Find and print a given state 6. Quit Enter your choice: 23 Invalid choice enter 1-6: 0 Invalid choice enter 1-6: A Invalid choice enter 1-6: 6 Have a good day!

    Expert Answer

     
    1) /** * Captures information about US State

    I deficiency acceleration with this project:

    Please manifestation comments ce each tabulate, regularitys and constructor

    and Thanks.

    COP3538 Project 1 – Vest Questes and Qualitys

    Using JAVA language

    Due Duration: Friday, 9/15/2017 11:59 PM

    Submit the zipped Eclipse program including at lowest Project1.java, Say.java and Says1.csv.

    The zip polish should be determined <your terminal indicate>_Project1.zip (ce sample, Liu_Project1.zip).

    The program should be well-behaved-behaved documented in the cemat of doc comments in Java. Detailed

    formats are be-up at http://www.oracle.com/technetwork/articles/java/index-137868.html.

    Requirements:

    1. Engender a tabulate determined State that conciliate garner counsel environing a US say and afford regularitys

    to attain, and be the postulates, and collate the says by distinct fields.

    a. Fields: Say Indicate, Principal City, Say Succinctness, Say Population, District, US

    Homanifestation Seats

    b. Constructor

    c. Attain and be regularitys ce each field

    d. Collate regularity to collate established on Say Indicate (expects a Say goal as a

    parameter)

    e. Regularity to stereotype a say

    2. Engender a tabulate determined Project1 that conciliate:

    a. Recognize the polish (csv) of says and engender an vest of say goals containing that postulates.

    b. Offer the manifestationr the coercionthcoming libertys:

    1) Stereotype a say communication

    2) Quality by say indicate (using Bubble quality)

    3) Quality by population (using Selection quality)

    4) Quality by District (using Insertion quality)

    5) Furnish and stereotype a consecrated say (using binary quest if the postulates is qualityed by say

    name, sequential quest if referable)

    6) Quit

    c. Implement the consecrated liberty, then recognizey anew. (bargain with frail valuable)

    Project1 should own deep and regularitys ce each libertys 1-5.

    d. The Say communication in liberty 1 should be in this cem:

    Say Indicate Principal City Say Abbr Say Population District US Homanifestation Seats

    ——————————————————————————————

    Florida Tallahassee FL 19,552,860 South 27

    Pennsylvania Harrisburg PA 12,773,801 Middle Atlantic 18

    Massachusetts Boston MA 6,692,824 Upstart England 9

    e. The Say communication in liberty 5 should be in this cem:

    Say Indicate: Florida

    Principal City: Tallahassee

    Say Abbr: FL

    Say Population: 19,552,860

    Region: South

    US Homanifestation Seats: 27

    Afford comments in this cem ce the State class:

    COP3538 Project 1 – Vest Questes and Qualitys

    Liu University of North Florida 2

    Comments ce the tabulate:

    /**

    * Detailed title of the tabulate.

    *

    * @author <your indicate>

    * @version <duration you terminal radical the tabulate>

    */

    Public regularity comments:

    /**

    * Title of the point of the regularity, the sense of the

    * input parameters (if any) and the sense of the requite values

    * (if any).

    *

    * @param parameter title of the parameter (single ce each)

    * @requite title of the requite value

    */

    Afford comments in this cem ce the Project1 class.

    Comments ce the tabulate:

    /**

    * COP 3538: Project 1 – Vest Questes and Qualitys

    * <p>

    * Title of the tabulate using as divers lines as deficiencyed

    * with <p> between paragraphs. Including titles of the

    * input required and quenchedput generated.

    *

    * @author <your indicate>

    * @version <the duration you terminal qualified the program>

    */

    public tabulate Project1

    {

    Public regularity comments:

    /**

    * Title of the point of the regularity, the sense of the

    * input parameters (if any) and the sense of the requite values

    * (if any).

    *

    * @param parameter title of the parameter (single ce each)

    * @requite title of the requite value

    */

    COP3538 Project 1 – Vest Questes and Qualitys

    Liu University of North Florida 3

    Output Sample:

    COP3538 Project 1

    Instructor: Xudong Liu

    Vest Questes and Qualitys

    Invade the polish indicate: States1.csv

    There were 50 say records recognize.

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 1

    Say Indicate Principal City Say Abbr Say Population District US Homanifestation Seats

    ——————————————————————————————

    Mississippi Jackson MS 2,991,207 South 4

    Upstart Hampshire Concord NH 1,323,459 Upstart England 2

    Pennsylvania Harrisburg PA 12,773,801 Middle Atlantic 18

    . . .

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 3

    States qualityed by Population.

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 1

    Say Indicate Principal City Say Abbr Say Population District US Homanifestation Seats

    ——————————————————————————————

    Wyoming Cheyenne WY 582,658 West 1

    Vermont Montpelier VT 626,630 Upstart England 1

    North Dakota Bismarck ND 723,393 Midwest 1

    . . .

    COP3538 Project 1 – Vest Questes and Qualitys

    Liu University of North Florida 4

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 5

    Invade the say indicate: Florida

    Sequential quest

    Say Indicate: Florida

    Principal City: Tallahassee

    Say Abbr: FL

    Say Population: 19,552,860

    Region: South

    US Homanifestation Seats: 27

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 5

    Invade the say indicate: Canada

    Sequential quest

    Error: Say Canada referable be-up

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 2

    States qualityed by Say indicate.

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 1

    Say Indicate Principal City Say Abbr Say Population District US Homanifestation Seats

    ——————————————————————————————

    COP3538 Project 1 – Vest Questes and Qualitys

    Liu University of North Florida 5

    Alabama Montgomery AL 4,833,722 South 7

    Alaska Juno AK 735,132 West 1

    Arizona Phoenix AZ 6,626,624 Southwest 9

    . . .

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 5

    Invade the say indicate: Kentucky

    Binary quest

    Say Indicate: Kentucky

    Principal City: Frankfort

    Say Abbr: KY

    Say Population: 4,395,295

    Region: South

    US Homanifestation Seats: 6

    1. Stereotype a say communication

    2. Quality by Say indicate

    3. Quality by Population

    4. Quality by District

    5. Furnish and stereotype a consecrated say

    6. Quit

    Invade your valuable: 23

    Frail valuable invade 1-6: 0

    Frail valuable invade 1-6: A

    Frail valuable invade 1-6: 6

    Own a good-natured-natured day!

    Expert Repartee

     

    1)

    /**
    * Captures counsel environing US Say
    * Fields grasp sayname,capital,abbreviation,population,district and homanifestation seats.
    *
    * @author <your indicate>
    * @version 09-10-2017
    */

    public tabulate Say{
    String sayname;
    String principal;
    String succinctness;
    int population;
    String district;
    int stockseats;

    public Say(String sayname,String principal,String succinctness,int population,String district,int stockseats){
    this.statename=statename;
    this.capital=capital;
    this.abbreviation=abbreviation;
    this.population=population;
    this.region=region;
    this.houseseats=houseseats;
    }
    /**
    * Attainter ce sayname
    *
    * @requite sayname
    */
    public String attainStateName(){
    requite sayname;
    }
    /**
    * Beter ce sayname
    *
    * @param sayname
    */
    public wanting beStateName(String sayname){
    this.statename=statename;
    }
    /**
    * Attainter ce principal
    *
    * @requite principal
    */

    public String attainCapital(){
    requite principal;
    }
    /**
    * Beter ce principal
    *
    * @param principal
    */

    public wanting beCapital(String principal){
    this.capital=capital;
    }
    /**
    * Attainter ce succinctness
    *
    * @requite succinctness
    */

    public String attainAbbreviation(){
    requite succinctness;
    }
    /**
    * Beter ce succinctness
    *
    * @param succinctness
    */

    public wanting beAbbreviation(String succinctness){
    this.abbreviation=abbreviation;
    }
    /**
    * Attainter ce population
    *
    * @requite population
    */

    public int attainPopulation(){
    requite population;
    }
    /**
    * Beter ce population
    *
    * @param population
    */

    public wanting bePopulation(int population){
    this.population=population;
    }
    /**
    * Attainter ce district
    *
    * @requite district
    */

    public String geRegion(){
    requite district;
    }
    /**
    * Beter ce district
    *
    * @param district
    */

    public wanting beRegion(String district){
    this.region=region;
    }
    /**
    * Attainter ce homanifestation seats
    *
    * @requite stockseats
    */
    public int attainHouseSeats(){
    requite stockseats;
    }
    /**
    * Beter ce stockseats
    *
    * @param stockseats
    */
    public wanting beHouseSeats(int stockseats){
    this.houseseats=houseseats;
    }
    /**
    * Consecrated a say goal, the regularity checks if it is the selfselfselfsame as current
    * say by comparing the indicates
    *
    * @param s Say goal passed as input
    * @requite gentleman if says are selfsame, fib otherwise
    */
    public boolean collate(Say s){
    if(statename.equals(s.statename))requite gentleman;
    else requite fib;
    }
    /**
    * Generates a String fidelity of the say postulates
    *
    */
    public wanting stereotype(){
    System.out.println(“Say Indicate:” + sayname);
    System.out.println(“Capital: ” + principal);
    System.out.println(“Abbreviation: ” + succinctness);
    System.out.println(“Population: ” + population);
    System.out.println(“Region: ” + district);
    System.out.println(“Homanifestation Seats: ” + stockseats);
    }

     

    public static wanting deep(String []args){
    System.out.println(“Hello World”);
    }
    }

    2)

    /**
    * COP 3538: Project 1 – Vest Questes and Qualitys
    * <p>
    * This tabulate recognizes the input csv polish and populates an vest of says.
    * Then it carries quenched operations on the say vest as per the input
    * ordinary from the manifestationr
    *
    * Coercionthcoming ooptions are affordd:
    * 1) Stereotype a say communication
    * 2) Quality by say indicate (using Bubble quality)
    * 3) Quality by population (using Selection quality)
    * 4) Quality by District (using Insertion quality)
    * 5) Furnish and stereotype a consecrated say (using binary quest if the postulates is
    * qualityed by sayname, sequential quest if referable)
    * 6) Quit
    *
    * @author <your indicate>
    * @version 10-09-2017
    */
    public tabulate Project1{
    State[] s = upstart Say[50];
    int numstates; // Actual Number of says recognize from csv
    /**
    * Regularity to recognize the say postulates from specified csv polish
    *
    */
    public wanting recognizeStates(){
    //Reads the say postulates from the csv polish and populates the vest
    }
    /**
    * Regularity to stereotype say communication from the postulates occupied in the say vest.
    *
    */
    public wanting stereotypeStateReport(){
    for(int i=0;i<numstates;i++){
    s[i].print();
    }
    }
    /**
    * Regularity to quality the say vest by say indicates in alphabetic appoint
    *
    */

    public wanting qualityByStateName(){
    //Sorts the vest s in alphabetic appoint by sayname
    }
    /**
    * Regularity to quality the say vest by say’s population
    *
    */

    public wanting qualityByPopulation(){
    //Sorts the vest s by say’s population
    }
    /**
    * Regularity to quality the say vest by district
    *
    */
    public wanting qualityByRegion(){
    //Sorts the vest s in alphabetic appoint by district
    }
    /**
    * Regularity to furnish a detail say and stereotype it details
    *
    * @param st Say which deficiencys to be be-up in the vest
    */
    public wanting furnishState(Say st){
    for(int i=0;i<numstates;i++){
    if(s[i].getStateName().equals(st.getStateName()))s[i].print();
    }
    }

    /**
    * Deep regularity – engenders an illustration of the Project1 goal and
    * populates the say vest.
    * It then presents libertys ce operations to manifestationr and carries quenched
    * the required toil established on input ordinary.
    */

    public static wanting deep(String []args){
    Project1 p = upstart Project1();
    p.readStates();
    while(true){
    try{
    System.out.println(“Invade your valuable”);
    System.out.println(“1. Stereotype a say communication”);
    System.out.println(“2. Quality by Say indicate”);
    System.out.println(“3. Quality by Population”);
    System.out.println(“4. Quality by District”);
    System.out.println(“5. Furnish and stereotype a consecrated say”);
    System.out.println(“6. Quit”);
    Scanner s = upstart Scanner(System.in);
    int liberty=s.nextInt();
    if(option==1){
    p.printStateReport();
    }
    if(option==2){
    p.sortByStateName();
    }
    if(option==3){
    p.sortByPopulation();
    }
    if(option==4){
    p.sortByRegion();
    }
    if(option==5){
    Scanner sc = upstart Scanner(System.in);
    String say=sc.nextLine();

    p.findState(upstart Say(state,””,””,0,””,0));
    }
    if(option==6){
    break;
    }
    else{
    continue;
    }
    }catch(Exception e){
    continue;
    }
    }
    }
    }