Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need a help on this problem, and please follow input.txt exactly as the question . Thank You QUESTION 2 Ministry of Transport Malaysia is
I need a help on this problem, and please follow input.txt exactly as the question. Thank You
QUESTION 2 Ministry of Transport Malaysia is required to prepare a report of the total road accidents by states in Malaysia from the year, 2006 to 2015. INSTRUCTIONS: Write a CH program to calculate the average number of road accidents for each state and find the highest number of road accidents from 2006 to 2015. Your program should be able to do the following tasks: (a) The program should use the following struct definition: struct dataAcc { int numAcc[10]; /umber of road accidents from 2006-2015 string state; //states in Malaysia float avg; //average number of road accidents for 2006-2015 (b) The program should use an array of struct defined in (a) to store the total road accidents by states in Malaysia from 2006 to 2015. (c) The program will read input data from an input file named input 1.txt" into the array of struct declared in (b). Example of input data in "input.txt" is shown in Figure 3. (d) The program should have two (2) global constants and one (1) global variable as follows: Global contants: NUM_STATE = 14 Number of states NUM_YEAR = 10 - Number of years Global variable: out Variable to point to output file named "output.txt" (C) Besides the function main(), the program has three (3) other functions as described in Table 1. One of the functions is given below: void displayLine() ( for (int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started