Create a class called Helper. Your class will have no state and only a single method called smooth. The smooth method takes an a

Question

Create a class called Helper. Your class will have no state and only a single method called smooth. The smooth method takes an array of doubles and modifies the array. The method does not return anything. The method will modify the data in the input array as follows: each consecutive pair of numbers will be replaced by the average of the two numbers. Each of the first two numbers are replaced by the average of the two numbers, the 3rd and 4th umbers are replaced with the average of the 3rd and 4th numbers, etc. If the array has odd length, just leave the last number in the array as it is. 

For example, 

1) if A = {1.0, 3.0}, calling smooth(A) returns nothing but then A is now the array {2.0, 2.0}. 

2) if A = {1.0, 3.0,7.5}, calling smooth(A) returns nothing but then A is now the array {2.0, 2.0, 7.5}. 

3) if A = {1.0, 3.0, 2.5, 3.5}, calling smooth(A) returns nothing but then A is now the array {2.0, 2.0, 3.0, 3.0}. 

A user of your class should be able to call the smooth method WITHOUT having to create a Helper object. Do NOT create any new arrays in your solution.

Details
Purchase An Answer Below

Have a similar question?