subject

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)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
Answers: 1
question
Computers and Technology, 23.06.2019 04:00
Write a method that takes in an array of point2d objects, and then analyzes the dataset to find points that are close together. be sure to review the point2d api. in your method, if the distance between any pair of points is less than 10, display the distance and the (x,y)s of each point. for example, "the distance between (3,5) and (8,9) is 6.40312." the complete api for the point2d adt may be viewed at ~pf/sedgewick-wayne/algs4/documentation/point2d.html (links to an external site.)links to an external site.. try to write your program directly from the api - do not review the adt's source code.
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
What machine listens for http requests to come in to a website’s domain? a. a router b. a browser c. a server d. a uniform resource locator
Answers: 1
question
Computers and Technology, 23.06.2019 12:30
Animations and transitions are added from the
Answers: 1
You know the right answer?
Write a program that uses nested loops to collect data and calculate the average rainfall over a per...
Questions
Questions on the website: 13722363