INFO ABOUT THE PROGRAM
/*
dive_data.txt info
1 3.5 5.5 6.0 7.0 6.5 6.5 5.5 7.5
2 2.0 8.0 8.5 8.5 9.0 8.0 8.5 8.0
I already got rid of 1 because it was an int, and the teacher said to remove the int, but I can't get rid of 3.5.
I want to get rid of 3.5 and store in in a variable. so my math.min is 5.5 instead of 3.5
I'm having a hard time picking doubles from doubles.
sorry first time using this website so im kind of disorganized.
*/
public static double calculateOneScore(String diveLine) { // calculate each
// diver score
Scanner console = new Scanner(diveLine); // store diveline in console
double max = 0.0; // hold the maximum for a line of score
double min = 10; // hold the minimum for a line of score
double sum = 0.0; // hold the sum of all score
double num = 0.0; // num store next double line of file score
double difficulty = 0.0; // store the difficulty score
while (console.hasNextInt()) {
int diverNum = console.nextInt();
while (console.hasNextDouble()) { // test if the file line as a
num = console.nextDouble(); // store double in num
if (num <= 4) { // test the difficulty
difficulty = num; // store difficulty num
}
sum += num; // add sum to num and store in sum
max = Math.max(max, num); // get the max number
min = Math.min(min, num); // get minimum
}
}
sum = sum - (max + min);
sum = sum * difficulty * 0.6;
return sum;
}