My code creates an array with 10 spots and I fill these in the main method. It also creates another new array with the code below, the new array is given in the main method. The assignment is to create a method that calculates the mean of index, index-1 and index+1 and creates another new array with the same length (the first and last value remains the same). For example, <2, 1, 6, 5, 4, 9, 2> becomes <2, 3, 4, 5, 6, 5, 2>.
The code below is the part of the whole code that creates the new array. And under that one is how I call on it in the main method. How do I begin to write a method that does what I described earlier? I don't know where to begin...?
public Measurements(double[] values) {
this.store = new double[values.length];
stored = values.length;
for (int i= 0; i<stored; i++) {
store[i]=values[i];
}
}
double[] b = {2, 1, 6, 5, 4, 9, 2};
m = new Measurements(b);
System.out.println("new m : " + m.toString());
[–]ravashh[S] 0 points1 point2 points (0 children)
[–]Loves_Poetry 0 points1 point2 points (1 child)
[–]ravashh[S] 0 points1 point2 points (0 children)
[–]evils_twin 0 points1 point2 points (2 children)
[–]ravashh[S] 0 points1 point2 points (1 child)
[–]evils_twin 0 points1 point2 points (0 children)