HIV
September 8, 2020
Emergency Management
September 8, 2020
Show all

Array Searches and Sorts

Submit    the    zipped    Eclipse    project including    at    least    Project1.java,    Country.java and   
Countries1.csv.        The    zip    file    should    be    named    <your    last    name>_Project1.zip (for    example,   
Liu_Project1.zip).        The    Countries1.csv    file    contains    information    about    all    155 countries    (and   
regions) in    the    world.        We    shall    call    all    these    places    countries for    our    projects.        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 Country that will store information about a country and provide
methods to get, and set the data, and compare the countries by several fields.
a. Fields: Name, Code, Capitol, Population, GDP, HappinessRank
b. Constructor
c. Get and set methods for each field
d. Compare method to compare based on Name (expects a Country object as a
parameter)
e. Method to print a country object
2. Create a class named Project1 that will:
a. Prompt user to enter the name of the CSV file, e.g., Countries1.csv, as input to the
system.
b. Parse Countries1.csv and create an array of country objects containing the data in the
file.
c. Offer the user the following options:
1) Print a countries report
2) Sort by Name (alphabetically using Insertion sort)
3) Sort by Happiness Rank (ascendingly using Selection sort)
4) Sort by GDP per capita (descendingly using Bubble sort)
5) Find and print a country for a given name (using binary search if the data is
sorted by name, sequential search if not)
6) Quit
d. Implement the given option, then prompt again. (deal with invalid choice)
Project1 should have main and methods for each option 1-5.
e. The Country report in option 1 should be in this form:  see form in pdf
f. The Country report in option 5 should be in this form:  see form in pdf

Leave a Reply

Your email address will not be published. Required fields are marked *