Ok, I have absolutely no idea what is going on for my compiler errors. I am not worried about the last part where I have to put in the letter code. I am just trying to figure out how to make this compile correctly for line 43 to work. I am getting tired of easter egging with it and the tutor at my school is always busy because we are coming up upon finals week. This is not a final project, just another lab that I have to turn in. My partner and I have been struggling with this since last week Wednesday.
----jGRASP exec: javac -g Student.java
Student.java:43: 'else' without 'if'
else clear (minScore);
^
1 error
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
public class Student
{
public static final int MAX = 5;
private String name;
private int[] scores;
private int finalScore;
public Student(String name)
{
this.name = name;
scores = new int[MAX -1];
finalScore = 0;// Fill in the constructor to initialize all of the instance variables
}
public void add(int score, int which)
{
if (score < MAX)
scores[which] = score;
if (which <= 0)
return finalgrade; // Fill in this method to set a score in the scores array.
// If which is zero, set the final exam grade (finalScore)
}
public void clear(int which)
{ if (score[which] = 0)
clear (finalScore); // Fill in this method to clear a score in the scores array
// If which is zero, clear the final exam grade (finalScore)
}
public void clearAll()
{ scores = new int[MAX -1];
finalScore = 0; // Clear all the scores in the array, and the final exam score
}
public void display()
{
int minScore = scores[0];
int total = scores[0];
for (int i = 0; i < scores[i]; i++)
if (minScore > scores[i]);
minScore.equals(scores[i]);
else clear (minScore);
/* Fill in this part of this method.
total should be the sum of the quiz grades
but drop the minimum grade. */
double avgScore = total / (MAX - 1);
char grade;
double numberScore;
/* Fill in this part of the method.
If there is a final exam grade (finalScore>0),
numberScore = 40% of the final exam score
plus 60% of the average quiz score.
If there is no final exam grade (=0),
numberScore should just be the average quiz score
grade is either ‘A’, ‘B’, ‘C’, ‘D’, or ‘F’ as we calculated
in a previous lab.
*/
System.out.printf("%-25s", name);
for (int i=0; i<5; i++) System.out.printf("%3d ", scores[i]);
System.out.printf(" %7.2f %7.2f %c\n"
, finalScore, numberScore, grade);
}
public boolean equals(String who)
{
return name.equals(who);
}
} // End of Student class