Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please Help me Code this in JAVA!!! In this assignment, we will be doing simple data analysis on a csv file. This file holds data

Please Help me Code this in JAVA!!!
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
In this assignment, we will be doing simple data analysis on a csv file. This file holds data about the United States Census in 2015. We will be looking to find what percentage of the population is Male or Female as stated in the file. In the csv file, each record(each row) contains data for each county of a state. This file contains the following attributes. Censusld, State, County, TotalPop, Men, Women, Hispanic, White, Black, Native, Asian, Pacific, Citizen, Income, IncomeErr, IncomePerCap, IncomePerCapErr, Poverty, ChildPoverty, Professional, Service, Office, Construction, Production, Drive, Carpool, Transit, Walk, OtherTransp, WorkAtHome, MeanCommute, Employed, PrivateWork, PublicWork, SelfEmployed, FamilyWork, Unemployment The attributes that are highlighted in italics are the only columns that we are concerned about for this assignment, the rest are obligatory. You will need to create an output file named censusoutput.csv in Isubmissions that will contain the output of your program. 1. What percentage of the total population of a state are men? 2. What percentage of the total population of a state are women? As an example, the output file should have the content that is similar to the following(numbers shown here are NOT actual outputs). There are no unit tests for this assignment or any requirements to write javadocs. You will just need to get the correct output in a CSV file for this part of the assignment. You must use arraylists for this assignment!!! DO NOT USE ARRAYSI!! How to get the values from the state of Alabama to do your Hand Calculating To get the information for your hand calculations you will need to filter your rows in your csv. Intelli supports this with the csv plugin that you should have installed. 1. Go to app/data/acs2015_county_data.csv in the project viewer on the left of the Intellij window. 2. Double-click the csv file to open it in the editor. 3. On the bottom of the file viewer screen click the data tab. 4. In the top left of the file viewer screen, click the magnifier glass to open the search bar. 5. Type in Alabama to the search bar and click the filter rows checkbox. 6. Take the data from the TotalPop, Men, and Women columns to do your hand calculations. Things to consider with FilelO 1. Any time you do file IO(Read/Write) you must wrap the calls in a try/catch. 2. Any time you open a file you must close it after you are done working with it. 3. You need to check if your output CSV exists or not and if it does rewrite it. 1. The readLine0 method reads a whole line of data, but this data contains all the attributes. 2. We are only interested in Censusld, State, County, TotalPop, Men, Women, thus we extract all attributes into data array by using the split method in the String class. 3. After the split the data[0] contains Censusid, data[1] contains State, and so on and so forth. 4. All these values are Strings, when you are computing totals and percentages you need to convert some of these Strings to numbers. The method calls Double.parseDouble 0 and Integer.parselnt 0 will allow you to do these conversions. Refer back to your past assignments in C201/1211 for a refresher. 5. You have to compute grand total population of the state, the total population of men of that state, and the total population of women of that state. Then store these data items ideally in a two-dimensional array. Once all the records are read, you can finally process the two-dimensional array to find the required percentages. Few things you have to think about!!! - How are we going to store the state name? A single dimensional string type array! - What is the size of the two-dimensional array? Count the unique number of states in the file for the number of rows. - What is the data type of the two-dimensional array? - How many columns do we need in our two-dimensional array? - At what point of code do we compute percentages? - At what point of code do we parse data? - How do I know the outputs are correct? (Hand calculations of data for few states, Yikes, I know!) - Did the program write all the required outputs? - Are there any missing outputs? I highly recommend writing comments in your main as pseudocode to help you keep on track. Reouired Tasks To complete this assignment you must do the following: - Your submission must compile and run. - Output a csv file to the submission folder that accurately shows the correct percentage of men and women per state. - Put Screenshot/Picture of all your "hand calculations" for Alabama in the submission folder. This file should be named "HandCalculations" in either png or jpg format. You can do this by hand or excel. - Put a Screenshot/Picture of both your hand calculation, and your program output agreeing on the output

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

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions

Question

122. If X is distributed as N(0, 1), find the pdf of .

Answered: 1 week ago