Rainfall Statistics (arrayManipulation.cpp)
 Posted by JanWan Last Updated: November 27, 2012   10148

Problem: Rainfall Statistics

Write a program that lets the user enter the total rainfall for each of 12 months into an array of doubles.

The program should have the following functions:

initializeArray: Accepts as arguments an array of type double, and the size of the array, of type int. This function should prompt the user to enter the rainfall for the 12 months of the year.

printArray: Accepts as arguments an array of type double, and the size of the array, of type int. This function should print the rainfall amounts for each month.

calculateTotal: Accepts as arguments an array of type double, and the size of the array, of type int.  This function should calculate and display the total rainfall for the year,

calculateAverage: Accepts as arguments an array of type double, and the size of the array, of type int.  This function should return the average monthly rainfall; use the calculateTotal function to compute the sum.

calculateMaximum: Accepts as arguments an array of type double, and the size of the array, of type int. The function should return the month with the highest amount.

calculateLowest: Accepts as arguments an array of type double, and the size of the array, of type int. The function should return the month with the lowest amount.

Input Validation: Do not accept negative numbers for monthly rainfall figures.

J.W. PRODUCTION

 Persons doing Introduction to Programming, this is your opportunity. Enjoy it...
 ```#include  #include  #include using namespace std; void initializeArray(double (&months)[12], int arraysize); void printArray(double months[], int arraysize); double calculateTotal(double months[], int arraysize); double calculateAverage(double months[], int arraysize); double calculateMaximum(double months[], int arraysize); double calculateLowest(double months[], int arraysize); int main() {     double months[12];     const int arraysize = 12;          double sum;     double avg;     double calmax;     double calmin;          initializeArray(months, arraysize);       system("cls"); cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"< maxx) maxx = months[count]; } return maxx; } double calculateAverage(double months[], int arraysize) {    double total = 0; double average;     total = calculateTotal(months, arraysize); average = total / arraysize; return average; } double calculateTotal(double months[], int arraysize) {        double sum = 0;        for(int i = 0; i < arraysize; i++)        {           sum = sum +  months[i];          }                        return sum; } void printArray(double months[], int arraysize) {   string monthNames[] = {"January","Febuary","March","April","May","June", "July","August","September","October","November","December"}; for (int count = 0; count < arraysize; count++) { cout << monthNames[count] << ": "<> months[count]; while (months[count] < 0) { cout << "Please reenter a positive number for the month of " << monthNames[count] << endl; cin >> months[count]; } }    } ```
 it proper...
 I made a few changes to the code. ```#include  #include  #include using namespace std; void initializeArray(double months[12], int arraysize); void printArray(double months[], int arraysize); double calculateTotal(double months[], int arraysize); double calculateAverage(double months[], int arraysize); string calculateMaximum(double months[], int arraysize); string calculateLowest(double months[], int arraysize); int main() {     double months[12];     const int arraysize = 12;          double sum;     double avg;     string calmax;          initializeArray(months, arraysize);       system("cls"); cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"< maxx) {       maxx = months[count];  mx = monthNames[count]; } } return mx; } double calculateAverage(double months[], int arraysize) {    double total = 0; double average;     total = calculateTotal(months, arraysize); average = total / arraysize; return average; } double calculateTotal(double months[], int arraysize) {        double sum = 0;        for(int i = 0; i < arraysize; i++)        {           sum = sum +  months[i];          }                        return sum; } void printArray(double months[], int arraysize) {   string monthNames[] = {"January","Febuary","March","April","May","June" ,"July","August","September","October","November","December"}; for (int count = 0; count < arraysize; count++) { cout << monthNames[count] << ": "<> months[count]; while (months[count] < 0) { cout << "Please reenter a positive number for the month of " << monthNames[count] << endl; cin >> months[count]; } }    } ```
 I'm going 2 reviewed the coding...