Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2. Use of strict performance evaluation and related reward systems.

Answered: 1 week ago