Question: C++ In this assignment, you will write a program that will read in a list of 12 doubles from a file. Each double represents the

C++ In this assignment, you will write a program that will read in a list of 12 doubles from a file. Each double represents the total rainfall in inches for the 12 months of the year in month order. The 12 doubles should be written into an array. The program should do the following with the data: Calculate the average rainfall for the year. Determine which month had the lowest amount of rainfall. Determine which month had the highest amount of rainfall. Sort the array of rainfall in descending order (highest rainfall first) using a bubble sort. Neatly display the average, minimum, and maximum rainfall. Be sure to display the month of the minimum and maximum rainfalls. Then display a table of month and rainfall amount from the sort that you did earlier. Each of the monthly rainfall, average, minimum, and maximum rainfalls should be displayed to two decimal places. You will not be given a sample program for this assignment. You have already done a similar program for reading in values from a file and finding averages, minimums, and maximums. The most difficult part of the assignment will be to display the correct months with the correct rainfall values after you have sorted them. I would suggest using parallel arrays for rainfall and months and every time you swap array indices for rainfall, you do the same swap for the months. Make sure you use good programming style. This includes commenting all your variables and commenting through your code. Comments should explain why you are doing something. Use good indentation (see my examples and the books examples for demonstration of good indentation). Make sure variable names are self-documenting. Make good use of white space. Group logical sections together with one blank line between logical sections. totalMonthlyrainfall2014.txt is : 0.33 0.41 1.45 1.74 3.40 3.26 0.98 4.34 0.06 2.09 2.13 1.13

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 Databases Questions!