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

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
Related Content