Question: Assignment With the past few years of highly variable rainfall across the state, the National Weather Service has hired you to write a program that
Assignment
With the past few years of highly variable rainfall across the state, the National Weather Service has hired you to write a program that calculates the highest/lowest rainfall measurements for a set of California counties. They want to use it in any of their branch offices, so the program must accept a list of any 5 counties, specified by the user.
Using values stored in arrays, write a program that:
- Asks the user for 5 California county names.
- Using a loop, prompts the user to enter the monthly rainfall totals (in inches) for each county.
- The value should be a floating point (double) type
- Validate the input. If it is less than 0 or greater than 50, request that the user re-enter that value.
- Use three value-returning functions to calculate the average, highest, and lowest counties.
- Output the results with two digits past the decimal point.
Example Input/Output
A run of your program should look like this (notice that some counties have more than one word in their name... including ours!)
Enter county #1: Contra Costa Enter county #2: Alameda Enter county #3: Santa Clara Enter county #4: Solano Enter county #5: Napa Enter the rainfall total for Contra Costa: 1.25 Enter the rainfall total for Alameda: 3.3 Enter the rainfall total for Santa Clara: 4.1 Enter the rainfall total for Solano: -11 Rainfall must be greater than 0 or less than 50. Please re-enter: 8 Enter the rainfall total for Napa: 4.92 Highest rainfall: Solano Lowest rainfall: Contra Costa Average rainfall: 4.31 inches.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
