I'm trying to teach myself how to program by looking for online project ideas. This one needs an average of 10 scores, also needs low score and high score.
Why does it say the min and max are the same? Here's my code:
import java.util.*;
import java.text.*;
public class ExamGrades
{
public static void main ( String [ ] args )
{
Scanner scan = new Scanner( System.in);
DecimalFormat answer = new DecimalFormat( "#0.00");
int grade;
int min = 0;
int max = 0;
double total = 0;
for( int i = 1; i <=10; i++)
{
System.out.print( "Please enter an exam grade between 0 and 100");
grade = scan.nextInt();
if ( grade >= 0 && grade <= 100)
{
max = grade;
min = grade;
total += grade;
if( grade < min)
{
min = grade;
}
if ( grade > max)
{
max = grade;
}
}
}
double average = total / 10;
System.out.println( "The minimun value of your exam grades is " + min);
System.out.println( "The maximum value of your exam grades is " + max);
System.out.println( "The average of your exam grades is " + answer.format(average));
}
}

