import java.util.*; import javax.swing.*; import java.io.*; public class StudentGrades { public static void main(String args[])throws Exception { // Declare input file to be opened. FileReader fr = new FileReader ("scores.dat"); BufferedReader br = new BufferedReader (fr); String studentName; String scoreString; int counter; double totalScore; final int MAX_SCORE = 9; double scoresArray[] = new double[MAX_SCORE]; scoresArray = new double[9]; while ((studentName = br.readLine()) != null)//Beginning of outer loop. { double score = scoresArray[0]; totalScore = 0; System.out.println (studentName); for (counter = 0; counter<MAX_SCORE; counter++) { scoreString = (br.readLine()); scoresArray[counter] = Double.parseDouble(scoreString); totalScore = scoresArray[counter] + totalScore ; // Accumulate a total of all scores. } int loopIndex; double scores; boolean flag = true; int temp; while (flag) { flag = false; for (scores = 1; scores < MAX_SCORE-1 ;scores++) { if (scoresArray[scores]<scoresArray[scores+1]) { temp = scoresArray[loopIndex]; scoresArray[loopIndex] = scoresArray[indexLoop-1]; scoresArray[loopIndex+1] = temp; flag = true; } } System.out.print ("Scores: "+ scoresArray[loopIndex]); System.out.printf("Total Score: %.2f" , totalScore); } } } }

ERRORS:

StudentGrades.java:43: error: possible loss of precision

if (scoresArray[scores]<scoresArray[scores+1])

^

required: int

found: double

StudentGrades.java:43: error: possible loss of precision

if (scoresArray[scores]<scoresArray[scores+1])

^

required: int

found: double

StudentGrades.java:45: error: possible loss of precision

temp = scoresArray[loopIndex];

^

required: int

found: double

StudentGrades.java:46: error: cannot find symbol

scoresArray[loopIndex] = scoresArray[indexLoop-1];

^

symbol: variable indexLoop

location: class StudentGrades

4 errors

I had originally had the "scores" as loopIndex and it didn't like that either! So can someone tell me what's up? I see that it thinks it wants an integer, because I'm assuming that the brackets are the count... but when I used int loopIndex it wasn't happy either!