Question: program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles . The program
program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display (in this order):
- the total rainfall for the year,
- the average monthly rainfall,
- and the months with the highest and lowest amounts.
Months should be expressed as English names for months in the Gregorian calendar, i.e.: January, February, March, April, May, June, July, August, September, October, November, December.
Input Validation: Do not accept negative numbers for monthly rainfall figures. When a negative value is entered, the program outputs "invalid data (negative rainfall) -- retry" and attempts to reread the value.
NOTE: Decimal values should be displayed using default precision, i.e. do not specify precision.
SAMPLE RUN #1: ./ETest
Interactive Session Input File: _stdin Output File: _stderr (empty) Output File: _stdout Hide Invisibles
Highlight: NoneStandard Input OnlyPrompts OnlyStandard Output w/o PromptsFull Standard OutputAllShow Highlighted Only
EnterrainfallforJanuary:1
EnterrainfallforFebruary:2
EnterrainfallforMarch:3
EnterrainfallforApril:4
EnterrainfallforMay:5
EnterrainfallforJune:6
EnterrainfallforJuly:7
EnterrainfallforAugust:8
EnterrainfallforSeptember:9
EnterrainfallforOctober:10
EnterrainfallforNovember:11
EnterrainfallforDecember:12
Totalrainfall:78
Averagerainfall:6.5
Leastrainfallin:January
Mostrainfallin:December
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
