Please download the csv file We will read in the csv file that can be found here
ID: 3811055 • Letter: P
Question
Please download the csv file We will read in the csv file that can be found here: https://github.com/washingtonpost/data-police-shootings The Washington Post is compiling a database of every fatal shooting in the United States by a police officer in the line of duty in 2015 and 2016. We will make an object to represent a record in this file and then read the data into an array of these objects. We can then answer questions regarding this data: 1. What was the percentage of records where the person was unarmed? 2. What percentage was Male? 3. How many shootings happened overall? How many were in California? Make a method to answer each of these questions.Explanation / Answer
Answer:
The first class is Record.java which represents each record in the csv file:
-------------------------------------------------------------------------------------------------------------------------------------------
The second class is DataAnalyser.java which contains the main method as well the methods required to answer the above questions:
--------------------------------------------------------------------------------------------------------------------------------------------
OUTPUT:
Percentage of Records, where person was unarmed: 7.24898694281855%
Percentage of Males: 95.76767221972085%
Total number of shootings: 2221
Number of shootings in California: 372