I cannot retain the multiplied indices of the two arrays and add them, it always retains and multiplies the last indices.

For this example, I have values {1, 2, 3} and weights {0.1, 0.2, 0.7} and it should do something like this: 1*0.1 + 2*0.2 + 3*0.7 which will give me 2.6.

I have no problem doing this 1*0.1, 2*0.2 and 3*0.7, but it only retains the last indices and gives me 2.1 instead.

```
public static void main(String[] args)
{
double[] values = {1, 2, 3};
double[] weights = {0.1, 0.2, 0.7};
System.out.println(weightedSum(values, weights));
}
public static double weightedSum(double[] values, double[] weights)
{
double multiply = 0;
double sum = 0;
for (int i = 0; i < values.length; i++){
multiply = values[i]*weights[i];
}
return multiply;
}
```

You are returning

`multiply`

, and not doing anything with`sum`

. Instead, perform addition on your multiplicands and then add them to`sum`

. Like,