fixed overall score calculation

This commit is contained in:
Joshua Perry 2023-02-01 13:51:03 +00:00
parent 3320977a12
commit 811eb582b8
1 changed files with 4 additions and 4 deletions

View File

@ -103,12 +103,12 @@ public abstract class Competitor {
public double getOverallScore() { public double getOverallScore() {
double output = 0; double output = 0;
for (int score: getScores()) { for (int score: getScores()) {
output += Math.log(score); //get the sum of the natural log of the scores if (Math.log(score) != Double.NEGATIVE_INFINITY) {
output += Math.log(score); //get the sum of the natural log of the scores
}
} }
output /= 1.93; //divide the sum by 1.93 output /= 1.93; //divide the sum by 1.93
if (output == Double.NEGATIVE_INFINITY) {
output = 0;
}
return Double.parseDouble(df.format(output)); //df.format() allows the scores to be formatted to 2 decimal places return Double.parseDouble(df.format(output)); //df.format() allows the scores to be formatted to 2 decimal places
} }
/** /**