I am trying to assign variables in my array diveScore using a for-each loop. However, I don't understand why it isn't working and every element is 0.0 after the loop has ended. Eclipse is showing no errors so I am sure there is something wrong with my logic.
Thanks.
double[] diveScores = new double[7];
int scoreCount = 1;
for (double element : diveScores)
{
System.out.println("Enter score " + scoreCount);
diveScores[scoreCount-1] = keyboard.nextDouble();
if (element < 0 || element > 10)
{
System.out.println("Score out of range 0 - 10. Please enter a valid score.");
element = keyboard.nextDouble();
}
scoreCount++;
}