Write a Java program that uses nested loops to collect data and calculate the average rainfall over period of years. First the program should ask
Write a Java program that uses nested loops to collect data and calculate the average rainfall over period of years. First the program should ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
Your program shall have input Validation; Do not accept a number less than t for the number of years. Do not accept negative numbers for the monthly rainfall. Inches of rainfall per month may be chosen by you.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started