Design and write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve 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 the iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. i. Assume the user will enter valid data (Integer/Float). ii. The outer loop will iterate once for each year and the inner loop will iterate twelve times once for each month. iii. Assume the user will enter 1 or more number of years for number of years. iv. Assume the user will enter positive number (0.00 or more) for rainfall in inches for each month. v. The program should round the rainfall average to a maximum of two decimal places.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.6: Nested Loops
Problem 5E: (Mathematical functions) Write a program that calculates and displays values for y when y=xz/(xz)...
icon
Related questions
Question
Design and write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve 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 the iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. i. Assume the user will enter valid data (Integer/Float). ii. The outer loop will iterate once for each year and the inner loop will iterate twelve times once for each month. iii. Assume the user will enter 1 or more number of years for number of years. iv. Assume the user will enter positive number (0.00 or more) for rainfall in inches for each month. v. The program should round the rainfall average to a maximum of two decimal places.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,