Let me start by saying, I am new to Java programming. I have coded something out that performs in the manner that I want it to. However, it is not very well written.
Here is my code:
import java.lang.Math;
public class Advisor_Score {
public static void main(String[] args){
double p1_1[] = {101,1,1,1.5,.5};
double p1_2[] = {101,2,2.5,2,4};
double p2_1[] = {102,1,5,5,5,5,5,5,5};
double p2_2[] = {102,2,2,5,3,4,5,1.5,2.5,5};
//These arrays represent individual users. The first value in the array is their customer number and the second is domain.
double All_users[][]={p1_1,p1_2,p2_1,p2_2};
//This is a 2-dimensional array takes into account all users.
double[] sum = new double[All_users.length];
double[] raw_advisor = new double[All_users.length];
double[] advisor_score = new double[All_users.length];
for (int i=0;i<All_users.length;i++){
for(int j=2;j<All_users[i].length;j++){
sum[i]+=All_users[i][j];
}
raw_advisor[i]=((sum[i]-(3*(All_users[i].length-2)))/4);
advisor_score[i]= 2.5+(2.5*(1-Math.pow(Math.E, -.5*raw_advisor[i])));
System.out.print("Customer ID "+All_users[i][0]);
System.out.print(", Domain "+All_users[i][1]);
System.out.println(": "+advisor_score[i]);
}
}
}
However I clearly over rely on the main method. I was wondering if anyone could help me integrate more methods and streamline the whole process. Thanks in advance, I am sorry again. I am new to Java and programming.