Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Each year the Department of Traffic Accidents receives accident count reports from a number of cities and towns across the country. To summarize these reports,

Each year the Department of Traffic Accidents receives accident count reports from a number of cities and towns across the country. To summarize these reports, the department provides a frequency distribution printout that gives the number of cities reporting accident counts in the following ranges: 099, 100199, 200299, 300399, 400499, and 500 or above. The department needs a computer program to take the number of accidents for each reporting city or town and add one to the count for the appropriate accident range. After all the data have been processed, the resulting frequency counts are to be displayed.

(Answer must be in C using functions)

Declare a prototype function get_acc_data that contains two int data type arrays, and one character type array. Define main() funciton. o Declare the required variables. o Prompt the user to enter the file name, and read the file name into variable file. o Call the get_acc_data function by passing the arguments file, city, acc_no arrays. Define the get_acc_data function. o Declare the a1, a2, a3, a4, a5 to maintain the frequency of accidents in the respective ranges. o Declare the file pointer fp. o Declare k and j variables to use them as index values, variable c to use an increment variable. o Declare i to read the values from the file and assign the values into the respective arrays. o Open the file, read the data into the respective arrays. Close the file. o Use a loop to find the accident frequencies by incrementing the a1-a5 variables respectively depending on the number of cities ranges. o Print the ranges with respect to the frequencies calculated.

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

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago