Question: PLEASE HELP CODE THE PROGRAM (please code in C, not C++) Functions & File I/ O Rainfall Statistics The amount of rainfall this year in
PLEASE HELP CODE THE PROGRAM (please code in C, not C++)
Functions & File I/O
Rainfall Statistics
The amount of rainfall this year in the top 8 cities in South Dakota (by population) for April, May, and June (through June 4), is shown in the rainfall table attached below, along with the total (year-to-year avg) rainfall for these months and cities. This data is also stored in a file named rainfall.txt. Please note that the city name is not stored, just its number.

Write a program to read the rainfall data file and create a rainfall report.
Store the report into a file named rainfall_report.txt.
The register should contain the following data for each region:
1) City Number
2) Total rainfall for April, May, and June so far this year (sum of 3 numbers shown in columns 2, 3, and 4 of table)
3) Year-to-Year Total for the 3 months (last column of table)
4) Difference between total so far this year and year-to-year total showing how much more rainfall is needed in June month to maintain the average
Your report should be printed in column format with a title and column headings.
You should have separate functions to:
i) Read a line of data.
ii) Calculate the total so far this year and the difference between that value and the year-to-year total.
iii) Print one line in the report.
Your program should work with files containing fewer or more records (lines) than those shown in the table above.
Your main function should print the report and column headings into the output file, then enter a loop which will:
Call a function to read a line of data from the input file. Use pass-by-reference (pointer parameters) to get the data back to main.
Call a function to calculate the items noted above. Use pass-by-value for data passed into this function and pass-by-reference (pointer parameters) for values calculated and sent back to main.
Call a function to write one line of the report to the output file. (Use pass-by-value for all parameters.)
The loop should iterate while there is data in the file and stop when all of the data in the file has been processed
City April May June Total (Year-to-Year Avg) 10.32 8.47 8.66 9.37 8.23 10.83 8.54 9.37 2.87 1.94 3.230.00 0.09 0.00 1 (Sioux Falls) 2 (Rapid City 3 (Aberdeen) 4 (Brookings) 5 (Watertown) 1.13 65 4.83 2.10 1.38 1.18 1.74 4.084.67 0.00 1.78 1.18 0.00 0.00 6 (Yankton) 7 (Pierre) 8 (Huron) 1.100.08 1.34 0.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
