Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5. Average Rainfall rite a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program

image text in transcribed
5. Average Rainfall rite 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. iteration of the inner loop will ask the user for the inches of rainfall for that month. fter all iterations, the program should display the number of months, the total inches of Each rainfall, and the average raintall per month for the entire period Use a named constant variable named MONTHS to represent how many months (12 e Format the output to 3 decimal places of precision (months is optional). . Your program should use a validation loop to reject negative input for the years . Include a flowchart documenting your programs logic A 20-Point Sample Run: Enter the number of years to track: -1 Negative years not allowed. Try again. Enter the number of years to track: -2 Negative years not allowed. Try again. Enter the number of years to track: -1 Negative years not allowed. Try again. Enter the number of years to track: 2 Enter a rainfall amount: 1.1 Enter a rainfall amount: 1.222 Enter a rainfall amount: 1.314 Enter a rainfall amount: 1.234 Enter a rainfall amount: 1.314 Enter a rainfall amount: 1.234 Enter a rainfall amount: 2.11 Enter a rainfall amount: 2.0 Enter a rainfall amount: 1.75 Enter a rainfall amount: 1.33 Enter a rainfall amount: 1.772 Enter a rainfall amount: 1.92425 Enter a rainfall amount: 2.22424 Enter a rainfal1 amount: 1.24234 Enter a rainfall amount: 1.234 Enter a zainfal1 amount: 1.2344 Enter a rainfal1 amount: 3.1234 Enter a rainfall amount: 3.14159 Enter a rainfall amount: 2.2222 Enter a rainfall amount: 3.1234 Enter a rainfall amount: 1.1234 Enter a rainfall amount: 2.1715 Enter a rainfall amount: 2.234 Months of rain: Total rainfal1: Average rainfall: 41.621" 1-734

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago

Question

Detailed note on the contributions of F.W.Taylor

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago