Question: Coding Assignment in Java (Prior INFO) Focus of the Assignment on Programming Techniques This assignment will focus on creating a immutable class, where once an

Coding Assignment in Java

(Prior INFO)

Focus of the Assignment on Programming Techniques

This assignment will focus on

creating a immutable class, where once an object has been created the data in the object cannot be altered, only accessed.

input from a large text data file where each line of will be a single record of data. The data from each record will be used to make a new object of the immutable class and will then be stored in an ArrayList.

use of a try-with-resources for reading the data in the large data file.

using ArrayLists of objects.

A good solution to this assignment will take advantage of the idea that ArrayLists only contain references to objects by making use of multiple ArrayLists that reference smaller and smaller subsets of the same set of objects.

I. Programming Assignment Overview

Institutions of higher education in the United States are required by law to track campus safety issues, including rates of various crimes. This data is gathered and made available in various forms via such sites as https://www.data.gov/. This programming project will use real world data about the frequency of serious crimes against persons occurring on campuses of higher education in the United States in the years 2014, 2015 and 2016. Your project will read the data from a provided text file, storing records (each record unique by school and year) in objects of a class of your own creation in an ArrayList, then use that data to analyze the data to provide reports based on user input.

Description of the Data in the File oncampuscrime.txt

Each line of data is the file is one unique record containing information about serious crimes against persons occurring in one year (2014, 2015 or 2016) on a campus of an institution of higher education in the United States. There are over 30,000 records in the file. Each record will consist of the following data values, each item of data separated by a space:

the year the state institution or campus type number of male students number of female students number of murders umber of negligent homicides - integer; -1 indicates data not available, otherwise the data is >= zero number of rapes - integer; -1 indicates data not available, otherwise the data is >= zero number of aggravated assaults- integer; -1 indicates data not available, otherwise the data is >= zero

Example of Data from the File oncampuscrime.txt

 2016 MA 2 15290 14618 0 0 1 0 2014 FL 3 418 538 0 0 0 0 2015 GA 4 432 1131 1 1 1 1 2014 MD 1 1803 2515 0 0 0 0 2015 MN 9 0 103 0 0 0 0 

- integer consisting of 2014, 2015 or 2016 - string consisting of the USPS abbreviation for a state - integer from 1 to 9 inclusive (equivalence list given below) - positive integer - positive integer - integer; -1 indicates data not available, otherwise the data is >= zero

 2016 CT 2 695 1170 0 0 7 2 

List of USPS State Abbreviations

 AL, AK, AZ, AR, CA, CO, CT, LA, ME, MD, MA, MI, MN, MS, OH, OK, OR, PA, RI, SC, SD, 
DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, TN, TX, UT, VT, VA, WA, WV, WI, WY 

CMPS 260 Spring 2018 Programming Assignment #7 (2018-04-10) 3

List of Institution or Campus Types

 1 public, 4 year or above 
 2 private nonprofit, 4 year or above 
 3 private for profit, 4 year or above 
 4 public, 2 year 
 5 private nonprofit, 2 year 
 6 private for profit, 2 year 
 7 public, less than 2 year 
 8 private nonprofit, less than 2 year 
 9 private for profit, less than 2 year 

(HELP NEEDED!!!!)

(b) Step 2: Isolate the crime objects of the desired campus / institution type.

i. Make a third ArrayList reference variable.

ii. If the campus type required is all campus types, assign the third ArrayList reference variable to refer to the second ArrayList of crime class objects.

iii. If the state is a specific state,

A. Create a third ArrayList object for the third ArrayList reference variable to reference.

B. Traverse the second ArrayList and add each crime object with the right campus type to the third ArrayList.

A. Create a third ArrayList object for the third ArrayList reference variable to reference.

B. Traverse the second ArrayList and add each crime object with the right campus type to the third ArrayList.

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!