Question: Finish the program below by adding the code to print the running average, where the average is based on a moving set of k values.

Finish the program below by adding the code to print the running average, where the average is based on a moving set of k values. For example, when k = 3, the program would print the average of {1, 2, 3}, then the average of {2, 3, 10}, then the average of {3, 10, 9}, and so forth, finishing with the average of {9, 10, 13}. Print the average to three decimal places. The code that you write should not be hard-coded to this particular data except for the fact that there are nine values in the list. Int k is given by user input. int[] d = {1, 2, 3, 10, 9, 8, 4, 5, 6, 6, 5, 6, 9, 10, 13}; int k;

USE JAVA TO COMPLETE CODE!!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!