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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!