I am trying to take a two-dimensional array and run it through a series of calculations in order to transform it into a one-dimensional array. However, when I run my program I keep getting this long error
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Duplicate local variable raw_advisor
Syntax error on token "i", delete this token
Type mismatch: cannot convert from double to double[]
Syntax error on token "i", delete this token
Type mismatch: cannot convert from double to double[]
Duplicate local variable advisor_score
Syntax error on token "i", delete this token
Type mismatch: cannot convert from double to double[]
at Advisor_Score.main(Advisor_Score.java:16)
Here is what my code looks like:
import java.lang.Math;
public class Advisor_Score {
public static void main(String[] args){
double l[] = {1};
double k[] = {2,2};
double m[] = {3,3,3};
double All_users[][]={l,k,m};
double sum[]={0,0,0};
double [] raw_advisor=new double [3];
double [] advisor_scored_scaled= new double [3];
double []advisor_score= new double [3];
for (int i=0;i<All_users.length;i++){
for(int j=0;j<All_users[i].length;j++){
sum[i]+=All_users[i][j];
}
double raw_advisor[i]=(sum[i]-(3*All_users[i].length))/4;
double advisor_score_scaled[i]= 2.5*(1-Math.pow(Math.E, -.5*raw_advisor[i]));
double advisor_score[i] = (2.5 + advisor_score_scaled[i]);
System.out.println(advisor_score[i]);
}
}
}
Thanks in advance! Sorry I am new to programming.