Solved

# urgent-map-pls help

Posted on 2006-04-07

This program takes the number of years and iterations to be runned. It then calculates the scores and stores them in the 2 dimensional score array based on the number of iterations and years.

For example,if the program is runned five times(iterations=3 and years=2), this could be the output.

score[year][iteration]

Iterations 1 Iteratons 2 Iterations 3

Years 1 2.666667 2.66667 2.66667

Years 2 3.2224 3.2221 3.4

so what i need to do is to find the percentage for the range based on years

For example, for year 1 , how many times got value between 2.6 to 2.7

For example, for year 2,how many times, got value between 3.2 to 3.3, 3.3 to 3.4

I just realized that the map below takes all the value in and does not consider it based on years..Is there a way to make the map think in years.

Map <Double,Integer> map=new HashMap<Double,Integer>();

for(int i=0;years+1;i++)

{

for(int j=0;j<iterations;j++){

Integer val=map.get(score[i][j]);

if(val==null)

map.put(score[i][j],1);

else

{

int newVal=val+1;

map.put(score[i][j],newVal);

}

}

}