lundi 20 avril 2015

How to us math.max and math.min to omit high and low scores

Vote count: 0

In my method, I am calculating 7 scores given to me in a file. I have to set the a max and min, initialize them that is, where I'm having problems at. Also, i have to use math.max and math.min with my sum. If more of my program is needed please ask. public static double calculateDiveScore(String diveLine) { Scanner diveLineSc = new Scanner(diveLine);

int dive = diveLineSc.nextInt();
double difficulty = diveLineSc.nextDouble();
double sum = 0.0;
double max = ;
double min = ;


for( int i = 1; i < 7; i++){
    double score = diveLineSc.nextDouble();
    max = Math.max(max,score);
    min = Math.min(min,score);
    sum +=score;

}

double totalScore = (sum - max - min )* difficulty * 0.6;

return totalScore;

}

asked 42 secs ago



How to us math.max and math.min to omit high and low scores

Aucun commentaire:

Enregistrer un commentaire