Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. First the

i need help

image text in transcribed

image text in transcribed

Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. First the program should ask the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 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 should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. Input Validation: Do not accept a number less than 1 for the number of years. Do not accept negative numbers for the monthly rainfall. Expected Output: For how many years, would you want to input rainfall data: Enter the number of years greater than 1:1 Enter the inches of rainfall for Year1 Month1 :-12 Enter a positive value for rainfall in Year1 Month1 :12 Enter the inches of rainfall for Year1 Month2 :13 Enter the inches of rainfall for Year1 Month3 :14 Enter the inches of rainfall for Year1 Month4 :15 Enter the inches of rainfall for Year1 Month5 :16 Enter the inches of rainfall for Year1 Month6 :17 Enter the inches of rainfall for Year1 Month7 :8 Enter the inches of rainfall for Year1 Month8 :19 Enten'the inches of rainfall for Year1 Month :20 Page Enter the inches of rainfall for Year1 Month10 :21 Enter the inches of rainfall for Year1 Month11:22 Enter the inches of rainfall for Year1 Month12:23 Total months =12 Total rainfall in inches = 200.0 Average Rainfall each month: 16.67

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_2

Step: 3

blur-text-image_3

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

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago