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:

0 99

100 199

200 299

300 399

400 499

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.

Problem Requirement

a) You must create a file and save it as Program4.c file.

b) You must use an array for the counts of the accident ranges.

c) The results must be displayed in a tabular format.

d) The program must have one user-defined function named updateRange with 2 arguments: accident count and the range array. The function should use the accident count to increase the count for the appropriate accident range array.

e) The program must have another user-defined function named displayRange with the range array as the argument. The function displays the content of the range array.

f) Your program should run correctly with the same inputs and outputs as given in the sample run.

Document Preview:

Programming Assignment #4 (for Ch 6) Problem Description 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: 0 99 100 199 200 299 300 399 400 499 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. Sample Run Problem Requirement a) You must create a file and save it as Program4.c file. b) You must use an array for the counts of the accident ranges. c) The results must be displayed in a tabular format. d) The program must have one user-defined function named updateRange with 2 arguments: accident count and the range array. The function should use the accident count to increase the count for the appropriate accident range array. e) The program must have another user-defined function named displayRange with the range array as the argument. The function displays the content of the range array. f) Your program should run correctly with the same inputs and outputs as given in the sample run.

Attachments:

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

Students also viewed these Programming questions