# Write a 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 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. After all iterations, the program chould display the number of months, the total inches of rainfall, and the average rainfall p

1 answer
###### Question:

Write a 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 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.
After all iterations, the program chould display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. (We are using class' with this challenge)
Input validation: Do not acept less than 1 for the number of years. Do not accept negative numbers for the monthly rainfall.
Output:
Enter the number of years: -2
Invalid. Enter 1 or greater: 2
Enter the rainfall, in inches, for each month.
Year 1 month 1: -3
Invalid. Enter 0 or greater: 3
Year 1 month 2: 5
Year 1 month 3: 7
Year 1 month 4: 9
Year 1 month 5: 6
Year1 month 6: 0
Year 1 month 7: 0
Year 1 month 8: 0
Year 1 month 9: 3
Year 1 month 10: 6
Year 1 month 11: 10
Year 1 month 12 8
Year 2 month 1: 7
Year 2 month 2: 6
Year 2 month 3: 10
Year 2 month 4: 8
Year 2 month 5: 4
Year 2 month 6: 0
Year 2 month 7: 0
Year 2 month 8: 0
Year 2 month 9: 4
Year 2 month 10: 15
Year 2 month 11: 12
Year 2 month 12: 5
Number of months: 24
Total rainfall: 128.0 inches
Average monthly rainfall: 5.333333333333333 inches (there are 15 3's)

## Answers

2 answers

### BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL

BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL BIOLOGICAL...
1 answer

### Determine the value of x. Question 9 options: A) 2 B) 2 C) D) 4

Determine the value of x. Question 9 options: A) 2 B) 2 C) D) 4...
1 answer

### Please help if you can

Please help if you can...
1 answer

### Which is an advantage of safely using uranium as an energy source, rather 1 point than using coal? * Uranium produces energy without polluting the atmosphere, while burning coal can increase the CO2 in the atmosphere. Uranium reduces the amount of thermal pollution, while burning coal can increase the amount of thermal pollution. Uranium is the most cost-efficient energy resource, while coal is the most expensive energy resource. Uranium can be easily mined from deep within Earth, while coal is

Which is an advantage of safely using uranium as an energy source, rather 1 point than using coal? * Uranium produces energy without polluting the atmosphere, while burning coal can increase the CO2 in the atmosphere. Uranium reduces the amount of thermal pollution, while burning coal can increase t...
2 answers

### Given the Numbers 18% and 0.7, explain which number is larger by using Words and/or pictures.

Given the Numbers 18% and 0.7, explain which number is larger by using Words and/or pictures....
1 answer

1 answer

### Interpretasyon ayon kay buckingham

interpretasyon ayon kay buckingham...
2 answers

### A rectangle has a perimeter of 30 inches.  Its length is one less than three times its width.  What are the length and width of the rectangle?

A rectangle has a perimeter of 30 inches.  Its length is one less than three times its width.  What are the length and width of the rectangle?...
1 answer

### Mark owns a ranch in colorado that costs $3.76 million per year to operate. of that, his explicit cost equals$3.29 million. therefore, his actual monetary cost of running the ranch is:

Mark owns a ranch in colorado that costs $3.76 million per year to operate. of that, his explicit cost equals$3.29 million. therefore, his actual monetary cost of running the ranch is:...
2 answers

### True or false "the product of -6 and -7 is less than the quotient of -100 and 2." ​

true or false "the product of -6 and -7 is less than the quotient of -100 and 2." ​...
2 answers

### D fb eor jerb ej fbndzxd r ba dffbfbafbfjlffa

d fb eor jerb ej fbndzxd r ba dffbfbafbfjlffa...
1 answer

### Select True or False for each statement. A bedroom is shaped like a rectangular prism. The floor has a length of 4.57 meters and a width of 4.04 meters. The height of the room is 2.3 meters. A. The perimeter of the floor with the correct number of significant digits is 17.22 True or False? B. The area of the floor with the correct number of significant digits is 18.46 square meters True or False? C. The volume of the room with the correct number of significant digits is 42 cubic meters True or

Select True or False for each statement. A bedroom is shaped like a rectangular prism. The floor has a length of 4.57 meters and a width of 4.04 meters. The height of the room is 2.3 meters. A. The perimeter of the floor with the correct number of significant digits is 17.22 True or False? B. The a...
2 answers

### How did the officer control this situation?

How did the officer control this situation?...
2 answers

### Mr. O would like to purchase a new computer for his home business. Mr. O's current computer runs very slow when he is running e-mail, doing the bookkeeping on spreadsheets, and listening to Internet radio. Based on this, which component would Mr. O be most concerned with when shopping for a new computer?

Mr. O would like to purchase a new computer for his home business. Mr. O's current computer runs very slow when he is running e-mail, doing the bookkeeping on spreadsheets, and listening to Internet radio. Based on this, which component would Mr. O be most concerned with when shopping for a new comp...
2 answers

2 answers

### Kari estimated the quotient of Negative 12 and one-fifth divided by 4 and two-fifths to be –8. Which best describes her error?

Kari estimated the quotient of Negative 12 and one-fifth divided by 4 and two-fifths to be –8. Which best describes her error?...
1 answer

### The period between the mid-1890s and 1920 is known as the ______________ _________.

The period between the mid-1890s and 1920 is known as the ______________ _________....
1 answer

### What is the magnification power of the ocular lens

What is the magnification power of the ocular lens...
1 answer

### How does the rise of nationalism after the Napoleonic wars lead to WWI?

How does the rise of nationalism after the Napoleonic wars lead to WWI?...
2 answers

### Write the expression two-cubed times seven as a numerical expression

Write the expression two-cubed times seven as a numerical expression...

-- 0.020064--