Question: Write a C + + program that will use a structure called weatherData to store the following information: Total Rainfall ( in inches ) High

Write a C++ program that will use a structure called weatherData to store the
following information:
Total Rainfall (in inches)
High Temperature (in Fahrenheit)
Low Temperature (in Fahrenheit)
Average Temperature (in Fahrenheit)
Your program should have an array of type weatherData of size 12 to store
weather data for each of the 12 months of the year. The data for each month
should be read from a file at the beginning of the program to populate each value
of the array. This task should be done in a function. Input file will be provide.
In addition, the following should be calculated and displayed in your program (they
should be done in functions).
Average monthly rainfall
Total rainfall for the year
Highest temperature
Lowest temperature
Your output should consist of this heading:
Month name, Total Rainfall(inches), Highest Temp, Lowest Temp, Average Temp.
Then followed with the month name and data read from file. Example:
January, 14,54,38,48
February, 12,54,35,44
etc
Note: You should have an array of month names to make it easy for you to print
the names of the months.
3
Lastly, followed by the following output of texts followed by values obtained
earlier in your program:
Average monthly rainfall :
Lowest temperature :
You should do this task in a function
Average rainfall, Highest Temp, Lowest Temp, Average Temp
14.1,54,38,48.5
12.5,54,35,44.3
11.1,62,42,49.1
8.7,65,48,56.2
4.2,73,56,62.7
3.1,88,62,69.6
1.8,101,78,81.0
1.1,102,80,89.1
0.9,98,76,87.3
8.2,78,62,69.7
10.6,69,56,61.3
12.5,60,45,50.2
(The first line of the above-mentioned file is a description only. Read it but don't process it. Also, the data shown in the file all made-up data - they are there only to serve our purpose of reading and process a file) When reading the screenshot of the infile please ignore chat, strings or any other data type that will not be saved to the array, no vectors please, I will upvote no problem as long as it works having trouble with this assignment(I will use notepad from windows 10 to create identical file to this for testing, if that helps). Thanks in advancement
Write a C + + program that will use a structure

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!