Question: Step #1: Create pseudocode for the following program: The program should use nested loops to collect data and calculate the average rainfall over a period
Step #1: Create pseudocode for the following program: The program should use 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 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 the 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: 1) Do not accept a number less than 1 for the number of years; 2) Do not accept negative numbers for the monthly rainfall. Display the total rainfall and the average rainfall rounded to 2 decimal places in fixed format with the decimal point and decimal digits always showing. (Use stream manipulators showpoint, fixed, and setprecision().) The final output should look like the following: Total rainfall: 75.00 inches Average rainfall per month: 6.25 inches Step #2: Convert your design in Step #1 into a C++ Program called CalcRainfall.cpp that corresponds to the pseudocode solution. Run your program with several test cases to be sure that it works properly, Step #3: Submit the pseudocode and C++ source files via the assignment link. Step #4: (Extra Credit: 10 Pts) Alter the pseudocode and C++ Program to accumulate the rainfall for each year in addition to the overall total rainfall. In addition to the Total rainfall and Average rainfall, display the rainfall for each year and the average rainfall per month for that year. When you have finished this lab, submit BOTH your design (pseudocode) and implementation (C++) via the assignment link.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
