Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that uses 1 nested loop to collect data and calculate the average rainfall over a period of years. The program should first

Write a program that uses 1 nested loop to collect data and calculate the average rainfall over a period of years.
The program should first ask for the number of years. Be sure to validate the input to be positive.
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. To simplify this loop, you don't need to validate the rainfall value.
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.
Below is a snapshot on how a program run should look.
For the text part of the programs run's output, you must duplicate the text itself and its formatting" as shown below)
NOTE-> I SUGGEST THAT WHEN YOU TEST YOUR PROGRAM, YOU DO 2 YEARS (24 MONTHS)
BUT DON'T HARDCODE THE OUTER LOOP TO BE FOR 2 YEARS AS THE PROGRAM SHOULD ACCOMOMODATE ANY NUMBER OF YEARS WE MIGHT WANT TO RUN THE CODE FOR
As you can see from the example output, they just show the running of the code for 1 year

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

Students also viewed these Databases questions

Question

3-1. What are the three steps in the writing process? [LO-1]

Answered: 1 week ago