Question: Create a new Java application called DataAnalyzer according to the specifications below. The input file should be called 'census-state-populations.csv' and should be created according to

Create a new Java application called "DataAnalyzer" according to the specifications below.

The input file should be called 'census-state-populations.csv' and should be created according to the highlighted instructions below. Note that even though you know the name of the input file, you should not hard-code this name into your program. Instead, prompt the user for the name of the input file.

The input file should contain (in order): the state (a string), a number (the population for that state).

Your program should allow the user to re-enter the input file name if one or more of the exceptions in the catch clauses are caught.

Your methods for getting data from input file should throw a FileNotFoundException which should be caught in the main method.

In your readData method, use hasNextLine() to check ahead of time whether there's a line in the data. That way when you try to get the nextLine, your code won't throw a NoSuchElementException.

The inputValues come from a single line in a text file (census-state-populations.csv) such as the following: Alabama,4849377 Alaska,736732 Arizona,6731484 Arkansas,2966369

The output must give the average population, the state with the highest population and the state with the lowest population.

Your output should look very much like the following: "

The average population for a state is: _______

The state with the highest population is:________

The state with the lowest population is:__________"

Creating the Input File

To create the input file, while in NetBeans with your project open, first click to highlight the top-level folder of your project, which should be called DataAnalyzer.

Then from the File menu do this:

File->New File Keep the Project name at the top; keep Filter blank Categories choose Other (at the bottom of the categories list) File Types choose Empty File (at the bottom of the files list) Next-> FileName: census-state-populations.csv Folder: this should be blank; if it's not, delete whatever's there. Finish

In the empty file census-state-populations.csv that you just created, add 50 lines of data from the census-state-populations.csv that can be downloaded census-state-populations.csvCreate a new Java application called "DataAnalyzer" according to the specifications below.

*** You must have comments in your code

*** You must have proper indenting in your code

*** Your code must run

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!