Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having trouble implementing part 3 of this question. part c, not part 3 I'll try to upload the data file accidents that I'm pulling

image text in transcribed

I'm having trouble implementing part 3 of this question.

part c, not part 3

image text in transcribed

image text in transcribed

I'll try to upload the data file accidents that I'm pulling from, but its huge

image text in transcribed

- stateName: String - accidentCount: int + StateAccident (stateID:int, stateName: String) + ... other Constructors as needed + ... setters and getters for all fields + incrementAccidentCount(): void + toString(): String + any other methods as needed Have an OuterMain class which drives the analysis. It should a) create an ArrayList of the type StateAccident, b) read the state id and name from StateCode.txt, create objects for each state, and add those objects into the ArrayList, c) read data from Accidents.txt and count how many accidents happened at each state. Update the accident Count for the StateAccident objects in the ArrayList. d) at the end output the stats by iterating over the ArrayList and call the toString() method for each objects. To verify, the result is shown below. Each line in the output should be a string returned by the toString() method. Look into the String.format() method if you want to format a string nicely. 1010 UN Alabama Alaska Arizona Arkansas California Colorado Connecticut 948 584 3572 508 252 07:17 22 * 100% Assignment 2 - Tra... Q : Assignment 2- Traffic Accident Analysis Due: Sunday, Feb 9 2020 Submission submit the State Accident.jave and Outer Main.java The attached files are the data for traffic accidents happened at different states. The Accidents.txt contains record for each accident, including at which state it happened denoted by the state 10), the number of vehides involved in that accident, number of persons involved in that accident, and the number of fatality Le., the number of people who died) in that accident. The State Code.txt contains the ID (code) and name for each state. Our job is to print out the total number of accidents happened at each state. The project should meet the following requirements: Have a State Accident class which implements the following UML as minimum: State Accident - State Dint stateName: String accident Count: int - StateAccident stateID: int, StateName: Snel woher Constructors os ceded * Setters and others for a feld increment Accident Count(): void + toString: String any cme n ded Have an Outer Main class which drives the analysis. It should a) create an ArrayList of the type State Accident, b) read the state id and name from StateCode.txt, create objects for each state, and add those objects into the ArrayList. c read data from Accidents.txt and count how many accidents happened at each state. Update the accident Count for the State Accident abjects in the ArrayList. d) at the end output the stats by iterating over the ArrayList and call the toStrinel) method for each objects. To verily, the result is shown below. Eachine in the output should be a string returned by the toString method Look into the String format/) method if you want to form a string nicely + ..ather Construction a n d + ... d er for af + incrementAccident Count : vold + toString: String on the das needed Have an OuterMain class which drives the analysis. It should al create an ArrayList of the type State Accident, b) read the state id and name from StateCode.txt, create objects for each state, and add those objects into the ArrayList, c) read data from Accidents.txt and count how many accidents happened at each state. Update the accident Count for the State Accident objects in the ArrayList. d) at the end output the stats by iterating over the ArrayList and call the toString() method for each objects To verify the result is shown below Eachine in the output should be a string returned by the tasting method. Look into the String.format() method ir you want to format a string nicely 31 District of Columbia 36 STATE VE TOTAL PERSONS FATALS 2 N NNNNNWPPNWNNNNNNNNNNW

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

Let 0

Answered: 1 week ago

Question

3. What may be the goal of the team?

Answered: 1 week ago

Question

Is how things are said consistent with what is said?

Answered: 1 week ago