Question: Help with this c++ code please 2. (Save this file as A6-2-YourLastName.cpp Write a C++ program that uses nested loops to collect data and calculate

 Help with this c++ code please 2. (Save this file as
A6-2-YourLastName.cpp Write a C++ program that uses nested loops to collect data
Help with this c++ code please

2. (Save this file as A6-2-YourLastName.cpp Write a C++ 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 w literate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop wil ask the user for the inches of rainfall for that month. After all iterations, the program should display the total number of months, the total inches of rainfa and the average rainfall per month for the entire Display the average to a tenth of a decimal. Allow the user to run this program as many times as desired. Perfo orm Input Data Validation: Do not accept a number less than 1 for the number of years. Do not accept negative numbers for the monthly rainfall Sample ow many years? ERROR INVALID NUMBER OF YEARS PLEASE TRY AGAIN How many years? 2 Year 1 How many inches of rain for month 1? How many inches of rain for month 2?2 How many incl of rain for month 3? l hes How many inches of rain for month 4?-2 ERROR INVALID Amount of rainfa PLEASE TRY AGAIN How many inches of rain for month 4? 2 How many inches of rain for month 5?2 How many inches of rain for month 6? 2 How many inches ofrain for month 7?-3 ERROR INVALID Amount of rainfa PLEASE TRY AGAIN How many inches of rain for month 7? 3 How many inches of rain for month 8? I How many inches of rain for month 9? How many inches of rain for month 10? 2 How many inches of rain for month l How many inches of rain for month 12?2 Year 2 How many inches of rain for month 1? 1 How many inches of rain for month 2? How many inches of rain for month 3? 2 How many inches ofrain for month 4? 2 How many inches of rain for month 5?2 How many inches of rain for month 6? How many inches of rain for month 8

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!