Okay so I'm supposed to read in grades from a file add them together and get the average the letter grade the minimum grade and the maximum...no setting variables to the read in...and the sentinel is -1 at the end of the sequence...I'm a bet messed up...this is what i have so far
import java.io.*;
import java.util.*;
public class Grader
{
static final int SENTINEL = -1;
public static void main(String[] args) throws
FileNotFoundException
{
Scanner inFile=
new Scanner(new FileReader("scores.dat"));
PrintWriter outFile = new
PrintWriter("scores.out");
//declare variables
int num;
int score;
int max;
int min;
char grade;
//receives information from file
num = inFile.nextInt();
if (num != SENTINEL)
do
{
score = 0;
num = inFile.nextInt();
score = score+num;
} while (num != SENTINEL);
if (score > 100)
System.out.println("Invalid data value. Program exiting...");
if ((score/10) >= 90)
grade = 'A';
else if ((score/10) >= 80 && (score/10)< 90)
grade = 'B';
else if ((score/10) >= 70 && (score/10)< 80)
grade = 'C';
else if ((score/10) >= 60 && (score/10)< 70)
grade = 'D';
else if ((score/10) < 60 && (score/10) > 0)
grade = 'F';
else
System.out.print("Error");
System.out.println(score);
inFile.close();
outFile.close();
}
}
help