Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CS 150: Problem Solving and ProgrammingI Extra Activity #1 For Extra credit Due Date: March 11, 2018 at 11:00 p.m. Design an algorithm and write
CS 150: Problem Solving and ProgrammingI Extra Activity #1 For Extra credit Due Date: March 11, 2018 at 11:00 p.m. Design an algorithm and write a C++ 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 should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. How many years do you wish to average? 2 ear 1 umber of inches of rain for month 17 3.4 umber of inches of rain for month 2? 2.4 umber of inches of rain for month 3? 5.4 umber of inches of rain for month 4? 3.6 umber of inches of rain for month 5? 1.9 umber of inches of rain for month 6? 3.2 umber of inches of rain for month 7? 3.9 umber of inches of rain for month 8? 4.6 umber of inches of rain for month 97 3.7 Number of inches of rain for month 10? 2.8 Number of inches of rain for month 11? 4.1 Year 2 Number of inches of rain for month 1? 3.1 Number of inches of rain for month 2? 2.9 umber of inches of rain for month 3? 4.7 umber of inches of rain for month 4? 3.5 umber of inches of rain for month 5? 2.1 umber of inches of rain for month 67 3.3 umber of inches of rain for month 7? 2.6 umber of inches of rain for month 87 5.1 umber of inches of rain for month 97 5.3 Number of inches of rain for month 10? 4.8 Number of inches of rain for month 11? 1.7 umber of inches of rain for month 127 2.6 over a period of 24 months, 85.9 inches of rain fell nches. process returned 0 (Oxo) execution time 136.300 s Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started