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
Step: 1
Get Instant Access to Expert-Tailored 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