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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Alert dont submit AI generated 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 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
Transcribed Image Text: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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 1 steps

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education