Question: Write a program that asks the user to enter daily rainfall amounts. Your program will need to accept 20 daily rainfall inputs. Only allow non-negative
Write a program that asks the user to enter daily rainfall amounts. Your program will need to accept 20 daily rainfall inputs. Only allow non-negative rainfall amounts. When the user enters a negative number, tell them that the number is invalid, and that they should enter another, valid value.
Calculate the total rainfall and the average rainfall. Determine the largest daily rainfall and the smallest daily rainfall.
Output the total, average, largest, and smallest values using informative messages.
The following things cannot happen in main:
- Accepting user input
- Calculation of total or average
- Determination of largest or smallest
- Outputting results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
