Question
Write a program that lets the user enter the total rainfall for each of 12 months into an array of double s. The program should
Write a program that lets the user enter the total rainfall for each of 12 months into an array of double s. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts.
Input Validation: Do not accept negative numbers for monthly rainfall figures.
================================================================
Hints
================================================================
// Chapter 7, Programming Challenge 2: Rainfall Statistics // Constant for the number of months // Function prototypes // Array to hold the rainfall data // Get the rainfall for each month. // Set the numeric output formatting. // Display the total rainfall. // Display the average rainfall. // Now display the largest & smallest amounts. // The subscript variable will be passed by reference // the the getLargest and getSmallets functions. int subScript; // Display the largest amount of rainfall. // Display the smallest amount of rainfall. return 0; } // ******************************************************** // The getTotal function calculates and returns the * // total of the values stored in the array parameter. * // The size parameter indicates the number of elements * // in the array. * // ******************************************************** double getTotal // ******************************************************** // The getAverage function returns the average of the * // values in the array parameter. The size parameter * // indicates the number of elements in the array. * // ******************************************************** double getAverage // ******************************************************** // The getLargest function returns the smallest value in * // the array parameter, and stores the subscript of the * // largest value in the element reference parameter. * // ******************************************************** double getLargest // ******************************************************** // The getSmallest function returns the smallest value in * // the array parameter, and stores the subscript of the * // smallest value in the element reference parameter. * // ******************************************************** double getSmallest
rainFall_output.pdf
RainfallMainRunShow.zip
Output help:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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