Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a COP 3538 Data Structures project that i need help writing a code using Java Language and that reads from a file(states1.csv) and

This is a COP 3538 Data Structures project that i need help writing a code using Java Language and that reads from a file(states1.csv) and output should be exactly the same as requested in the project. Would apreciate the help.

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:

Comments for the class:

/**

* Detailed description of the class.

*

* @author

* @version

*/

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

*/

Output Example:

COP3538 Project 1

Instructor: name

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago