Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program reads in locations followed by 12 lines of numbers that represent amount of rainfill for each month in that location. The
Write a program reads in locations followed by 12 lines of numbers that represent amount of rainfill for each month in that location. The program keeps reading until it encounters end-of-file. It must work for any number of locations. Do not assume that you know how many locations there are. Produce a nicely formatted report that shows the location, the month and rainfall for the month for all twelve months. Then display the total rainfall, the average rainfall per month the month and amount of greatest rainfall in that month. You are given a program shell that contains the function prototypes that you will implement. You must implement these functions. You may change the names of the parameters and the names of the functions but not the parameter lists or the return types of the functions. I am supplying one function that reads rainfall as strings and converts to double The shell also contains the main read-to-end-of-file loop in main. The program reads a data file that I named READRAINFALL.TXT which is also supplied. Submit your source code, and the output file produced by the program. Once the program works, create your own input data file with different locations. Submit the new input file and the output file produced by the program. Be sure that every function has a comment that states its purpose, as well as the normal program heading. Write your own comments. Do not keep old comments that I wrote! Below is output from my program for one location as an example of possible output. Statistics for Hayward Rainfall inches 5.22" Feb 1.50" Mar 3.50" Apr 2.10" May 0.80" Jun 0.00" [I Jul 0.00" Aug 0.00" Sep 0.98" Oct 1.65" Nov 3.18" 3.90" Total for the year 22.83 inches Average rainfall per month 1.90 inches Month with the greatest rainfall was Jan with rainfall of 5.22 inch Month Jan Dec
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Certainly Below is a simple C program that fulfills the requirements youve mentioned This program reads locations and corresponding rainfall data from ...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