You are working on development of a new water treatment plant for Spokane, Washington. Monthly rainfall data has been collected as part of designing the new water treatment plant, and you are required to develop a computer program that will perform statistical analysis. The input data file is called rainfall. As you examine the input file, you notice that the first record line is the name of the city and type of data, the second record line contains the control numbers, and the remaining record lines are the average monthly rainfall amounts: 12 rows (January – December) and 6 years (2015 – 2020). Write a C program that will read the data from the input file, such that the city name and type of data are stored in a one-dimensional character array, and the rainfall amounts are stored in a two-dimensional array. Manipulate the two-dimensional array to calculate the average rainfall for each year and the standard deviation in rainfall for each year. Then find the minimum and maximum rainfall and the locations in the array of the minimum and maximum values. The formula for standard deviation is:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

You are working on development of a new water treatment plant for Spokane, Washington. Monthly rainfall data has been collected as part of designing the new water treatment plant, and you are required to develop a computer program that will perform statistical analysis. The input data file is called rainfall. As you examine the input file, you notice that the first record line is the name of the city and type of data, the second record line contains the control numbers, and the remaining record lines are the average monthly rainfall amounts: 12 rows (January – December) and 6 years (2015 – 2020).

Write a C program that will read the data from the input file, such that the city name and type of data are stored in a one-dimensional character array, and the rainfall amounts are stored in a two-dimensional array. Manipulate the two-dimensional array to calculate the average rainfall for each year and the standard deviation in rainfall for each year. Then find the minimum and maximum rainfall and the locations in the array of the minimum and maximum values.

The formula for standard deviation is:


s= (x-x)2n-1

where s is the standard deviation, x is the individual sample values, x is the mean value, Σ is the summation, and n-1 is the number of values in the sample minus 1. In this case, n is 12 (number of months in the year) and x is the yearly average rainfall.

Print the output to the computer screen and to an output file called rain_report. Illustrated below is the output style for the computer screen and the output file.

OUTPUT FORMAT:

*****************************************************

                  Spokane-Rainfall

           2015   2016   2017   2018   2019   2020

Month 1 xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx    

Month 2    .     .     .      .     .     .

Month 3    .     .     .      .     .     .    

Month 4    .     .     .      .     .     .

Month 5        

Month 6        

Month 7       

Month 8       

Month 9        

Month 10        

Month 11        

Month 12        

Average:   xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx

St. Dev.: xx.xx xx.xx xx.xx xx.xx xx.xx xx.xx

REPORT SUMMARY:

Minimum rainfall is xx.xx inches in month xx, xxxx.

Maximum rainfall is xx.xx inches in month xx, xxxx.

*****************************************************

Note: In the report summary, xxxx refers to the year of min/max.

rain.report:

Spokane-Rainfall 12 6 1.91 2.74 1.85 2.55 1.75 3.48 1.04 0.72 4.39 1.60 2.40 0.89 2.43 3.30 4.11 1.30 0.71 0.70 0.53 0.32 1.60 2.03 1.47 0.40 0.85 0.78 1.31 1.45 1.35 2.86 0.07 0.51 0.71 0.55 0.44 1.19 0.19 0.27 0.00 0.06 0.52 0.12 0.18 0.16 0.01 0.17 0.48 0.02 0.52 0.21 1.21 0.02 1.98 0.33 1.14 6.23 1.40 1.64 1.53 1.66 0.77 1.57 2.88 1.96 0.68 1.52 4.45 1.49 2.88 2.60 1.68 1.52

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY