0

i have problem about the output in this code, my output so only the index 0.

how can i fix this.

```
public class d_2D {
static double[][] d =new double[6][4];
static double[][] e= {{},
{0.0,0.6,0.0,0.0},
{0.0,0.2,0.5,0.1},
{0.0,0.2,0.5,0.4},
{0.0,0.2,0.5,0.7},
{0.0,0.0,0.0,0.9}};
static double[] avg= new double[4];
static double[] sum= new double[4];
static int i,j,k;
public double getAverage(int j){
return avg[j]= sum[j]/k ;
}
public void setAverage(int i, int j,int k){
//average of column
for(j=1;j<e[1].length;j++){
sum[j]=0.0;
k=0;
for( i= 1; i < e.length; i++)
if(e[i][j]>0.0){
sum[j] += e[i][j];
k++;
}
}
}
public double getElement(int i, int j) {
return d[i][j]=Math.abs(e[i][j]-avg[j]);
}
public void setElement(int i, int j,int k) {
for(j=1;j<e[1].length;j++){
for( i= 1; i < e.length; i++)
if(e[i][j]>0.0){
sum[j] += e[i][j];
k++;
}
} }
public static void main(String args[])
{
// d_2D d_2D = new d_2D();
System.out.println("Average of j[" + j + "] = " +avg[j]);
System.out.println("d[" + i + "][" + j + "] = " + d[i][j]);
}
}
```

*Edited 5 Years Ago by ~s.o.s~*: Added code tags, please learn to use them.