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
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
Related questions
Question
Alert dont submit

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 1 steps

Recommended textbooks for you

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education