Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need some help with this project Java Programming Here is the states1.csv State Capitol Region US House Population Covid cases Covid deaths Median House income

Need some help with this project

Java Programming

Here is the states1.csv

State Capitol Region US House Population Covid cases Covid deaths Median House income Violent Crime rate
Pennsylvania Harrisburg Middle Atla 18 12801989 748564 18742 61744 306.4
Michigan Lansing Midwest 14 9986857 576573 14511 57144 437.4
South Carolina Columbia South 7 5148714 371180 5934 53199 511.3

Create a class named State that 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, capitol, region, population, the number of COVID-19 cases, and the

number of COVID-19 deaths, median household income, and violent crime rate.

b. Constructor

c. Get and set methods for each field

d. Method to print a State object

2. Create a class named Project1 that will:

a. Prompt user to enter the name of the CSV file, e.g., States1.csv, as input to theCreate a class named Project1 that will:

system.

b. Parse States1.csv and create an array of State objects containing the data in the file.

c. Offer the user the following options:

1) Print a States report

2) Sort by name (alphabetically using Bubble sort)

3) Sort by COVID-19 case fatality rate (CFR) (ascendingly using Selection

sort): CFR is the ratio of deaths over cases.

4) Sort by median household income (ascendingly using Insertion sort)

5) Find and print a State for a given name (using binary search if the data is

sorted by name; sequential search, if not)

6) Print Spearmans r correlation matrix in the following format

Median House hold income Violent Crime rate
COVID 19 death rate X X
COVID 19 case rate X X

(Case rate is the number of cases per 100,000 population. That is, case rate of a state is equal to its cases divided by its population and then times 100,000. Death rate is defined similarly. Violent Crime Rate from our dataset already is per 100,000. The Spearmans r correlation between two fields is defined next section. Xs are the actual values you computed.)

The spearman's r correlation is what is giving me the most trouble. I have no idea how to implement it in code

image text in transcribed

Let R1 and R2 be two ascending rankings of the same set of n elements. Then the Spearmans r between R1 and R2 is In the formula, di is the rank difference of element i in the two rankings R1 and R2

6d? = 1 (n2 1)

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

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

Question What is a secular trust?

Answered: 1 week ago