Starting from:

$35

CSC7081- Crime stats system Solved

You have been given some code that is currently being developed as part of a Crime Stats application specifically analysing recent Crime in USA cities. Not all the requirements have been implemented. It is your task to implement these and raise the coding standards of all the code. 

Create a project solution (named <Your Name><Student Number>Resit e.g. JamesBrown3048614Resit). Create a package named resit. Add StartApp.java to the solution and the crimeUSA.csv.  Ensure your name and student number are placed in the Javadoc comments of all the classes you create. The StartApp has been partially written with a menu.

The application will run (start) from the StartApp.java, initially reading in the data from the crimeUSA.csv file and then perform a number of menu driven operations.   

Part 1 – Data mapping, storage and read from file -
Using your knowledge of OOP you should add/update the code based on the following: 

Analyse the data in the csv and create a class (CityCrime.java) to represent the data in the csv file, include the following …
Each State name should be recoded as its abbreviation as detailed in the supplied csv file, e.g ALABAMA as AL etc.
Include a method to return as an int the total number of violent crimes (calculated from total of murder, robbery, assault)
Include a method to return as an int the total number of possession crimes (calculated from total of burglary, larceny and car theft
Validation rules :
No field should be empty and no numeric fields should be less than zero. Any records (city stats) that break these rules should not be included and stored in the arraylist in the system (see Part 1 – 4 below). 

Conduct a unit test for the CityCrimes
In the java class read and store the data in this arraylist :
public static ArrayList<CityCrime> cityCrimes = new ArrayList<CityCrime>(); 

Part 2 – Functions 
Having read the data from the csv file complete the menu driven functions as outlined below.  An example of the expected format is shown for each function (note: actual answers based on csv data provided are not necessarily the example output shown). 

Display all City crime stats to screen. Example output…
City          
: Abbeville
State         
: AL
Population  
: 2990
Murder        
: 0
Robbery       
: 0
Assault       
: 10
Burglary      
: 23
Larceny       
: 66
Car theft     
: 3
Violent crime 
: 10
Possession crime  : 92

___________________________________________________

 

City          
: Adamsville
State         
: AL
Population  
: 4889
Murder        
: 0
Robbery       
: 13
Assault       
: 29
Burglary      
: 38
Larceny       
: 228
Car theft     
: 23
Violent crime 
: 42
Possession crime 
: 289   
etc…

 

Display all crime stats for a selected City. Example output…
Enter option ...

2

Enter city 

Riverton

          City                 : Riverton

         State                : NJ

         Population           : 2741

         Murder               : 0

          Robbery              : 0

          Assault              : 0

          Burglary             : 6

          Larceny              : 31

         Car theft            : 0

         Violent crime        : 0

         Possession crime      : 37

Display the total murders in a selected state
Enter state to view total murders 

NY

Total murders 596 in NY

Calculate and display the highest overall crime stats
Enter option ...

4

City with highest crime stats 204451 is New York 

                City                     : New York

                State                     : NY

                Population                : 8165001

                Murder                   : 596

                Robbery                  : 23511

                Assault                  : 26908

                Burglary                 : 22137

                Larceny                  : 115363

                Car theft                : 15936

Violent crime               : 51015 Possession crime         : 153436

___________________________________________________

Display each state (in alphabetical order) with the total number of car thefts. Example output…
                Enter option ... 5

States and car theft

                          AK           1898

                          AL           9599

                          AR           5377

                          AZ            48322

File write - export/write to a new file (RobberyStats.csv) in the format Robbery, City. Descending order by robbery stat for each city. Format of the csv file shown below (include the header).
Robbery,City

23511,New York

15863,Chicago

14353,Los Angeles

11371,Houston

10971,Philadelphia etc… 

When complete compress (zip) the entire Eclipse solution and upload to Resit (Resit assessment) on

CANVAS. Remember to record and then upload a short commentary walk-through of your code with your solution (upload that too  

More products