ho scritto un codice per il massimo e per il minimo. è giusto?
codice:public int getMassimo() { int max = 0; int j = c.size() - 1; double x = c.get(j).getSomma(); double y = c.get(j).getSomma(); for(int i=0;i<=nrighe;i++){ if(x>y){ max=(int)x; } else{ max =(int) y; } } return max; } public int getMinimo() { int min = 0; int j = c.size() - 1; double x = c.get(j).getSomma(); double y = c.get(j).getSomma(); for(int i=0;i<=nrighe;i++){ if(x<y){ min=(int)x; }else{ min =(int)y; } } return min; }

Rispondi quotando