Question: Part 2: Rainfall Analyzer Write a program that will use a Scanner and loop to read in the average rainfall in inches for 12 months,

 Part 2: Rainfall Analyzer Write a program that will use a

Part 2: Rainfall Analyzer Write a program that will use a Scanner and loop to read in the average rainfall in inches for 12 months, store these values in an array, and then provide the following calculations: 1. Total annual rainfall 2. Average monthly rainfall 3. The month with the highest rainfall 4. The month with the lowest rainfall To start, create a for loop that will run 12 times, with a scan nextLine statement inside of it. Each time it scans in a value, place that value into an array of integers at the corresponding index (ie. when scanning rainfall for Month 1 when the loop is at i-0, place that scanned rainfall value into the array at index 0, etc) To print out the name of the month (like "January: 22 inches), it may be helpful to create a length 12 array of Strings with the names of the month. You can then use the rainfall month index (like index 0 for January's rainfall) to index the month name array (using index 0 in the month name would access the String "January"). Example output: (left is a more basic version, right is a more advanced version) Rainfall Calculator Rainfall Calculator Enter rainfall for Month 1 : 10 Enter rainfall for Month 2: Enter rainfall for Month 3: 12 Enter rainfall for Month 4:11 Enter rainfall for Month 5:15 Enter rainfall for Month 6:12 Enter rainfall for Month : 18 Enter rainfall for Month 8 10 Enter rainfall for Month 9: 9 Enter rainfall for Month 10:8 Enter rainfall for Month 11: Enter rainfall for Month 12:11 Enter rainfall for January: 10 Enter rainfall for February! 11 Enter rainfall for March: 12 Enter rainfall for April 13 Enter rainfall for May: 15 Enter rainfall for June: 17 Enter rainfall for July 18 Enter rainfall for Augusti 10 Enter rainfall for September Enter rainfall for October Enter rainfall for November Enter rainfall for December: 11 Total Annual Rainfall: 141.0 inches Average Monthly Rainfall: 11.75 inches Most rant 18 inches Least raint 7 inches Total Annual Rainfall: 141.0 inches Average Monthly Rainfalli 11.75 inches Most raint July (18 inches) Least rain: November (7 inches) The section of user input shown above can be done with a simple loop and a single Scanner nextLine() statement inside the loop. The print statement just cycles through the array of month names, subbing in the corresponding month. For example, when we fill index 0 of the int array, we use index 0 of the String array, which stores "January

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 Databases Questions!