In the provided A1Q1. java file, complete the rollingAverage () method. This method will compute the rolling average of some data using a specified width (number of data points used for the average). This method takes an array of floating point numbers (called data) and an integer (called width) as input. The method returns a new array that is the same size as the input array and will contain thc rolling average of the innut array data using vidth data oints for cach valuc
In the provided A1Q1. java file, complete the rollingAverage () method. This method will compute the rolling average of some data using a specified width (number of data points used for the average). This method takes an array of floating point numbers (called data) and an integer (called width) as input. The method returns a new array that is the same size as the input array and will contain thc rolling average of the innut array data using vidth data oints for cach valuc
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
please answer question in java, thanks
![In the provided A1Q1. java file, complete the rollingAverage() method. This method will
compute the rolling average of some data using a specificd width (number of data points uscd for
the average). This method takcs an array of floating point numbers (called data) and an integer
(called width) as input. The method returns a new array that is the same size as the input array
and will contain the rolling average of the input array data using width data points for cach value.
public static double] rollingAverage (double [] data, int width)
For cach position where there is not cenough data points (width) to compute the average, you
will use the NaN (Not-A-Number) value. In particular, the first width-1 clements of the output
array should have this value. Here are some cxamples:
A1Q1.rollingAverage (new double[]{1,2,4}, 1) -> [1.0, 2.0, 4.0]
A1Q1.rollingAverage (new double []{1,2}, 2) -> [NaN, 1.5]
A1Q1.rollingAverage (new double []{1,2,4,9}, 3) -> [NaN, NaN, 2.3333333333333335, 5.0]
A1Q1.rollingAverage (new double[0{1,2,4}, 4) -> [NaN, NaN,
NaN]
You will need to investigate and use Java's Double class to learn more about the value NaN.
In future assignments, restrictions on the input arguments passed to methods you create will be
provided as preconditions for the methods. For this assignment, they are listed here (as well as in
the provided java file). Note that no testing will involve input data that violates these restrictions.
data: 0 <= data.length <= Integer.MAX_VALUE/100
size: 1 <= width <= Integer. MAX_VALUE](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F15eb9198-d198-4a17-8396-aa3ae1e6e709%2Feee9f543-519f-4e8f-ba17-e7db1f0f6513%2Feppd5j_processed.png&w=3840&q=75)
Transcribed Image Text:In the provided A1Q1. java file, complete the rollingAverage() method. This method will
compute the rolling average of some data using a specificd width (number of data points uscd for
the average). This method takcs an array of floating point numbers (called data) and an integer
(called width) as input. The method returns a new array that is the same size as the input array
and will contain the rolling average of the input array data using width data points for cach value.
public static double] rollingAverage (double [] data, int width)
For cach position where there is not cenough data points (width) to compute the average, you
will use the NaN (Not-A-Number) value. In particular, the first width-1 clements of the output
array should have this value. Here are some cxamples:
A1Q1.rollingAverage (new double[]{1,2,4}, 1) -> [1.0, 2.0, 4.0]
A1Q1.rollingAverage (new double []{1,2}, 2) -> [NaN, 1.5]
A1Q1.rollingAverage (new double []{1,2,4,9}, 3) -> [NaN, NaN, 2.3333333333333335, 5.0]
A1Q1.rollingAverage (new double[0{1,2,4}, 4) -> [NaN, NaN,
NaN]
You will need to investigate and use Java's Double class to learn more about the value NaN.
In future assignments, restrictions on the input arguments passed to methods you create will be
provided as preconditions for the methods. For this assignment, they are listed here (as well as in
the provided java file). Note that no testing will involve input data that violates these restrictions.
data: 0 <= data.length <= Integer.MAX_VALUE/100
size: 1 <= width <= Integer. MAX_VALUE
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 3 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY