I am trying to write this program to get a user inputed number of grades up to 15. I then need to add the grades, find the largest, smallest and average of the grades, and finally display the results. Here is what I have so far. I can get past the input but when i get to processing thats where my code runs into problems.
import java.util.Scanner;
public class steal_ExamList
{
private final static int MAX_SCORE =15;
double number,small,large,average;
int count;
private double list [];
public steal_ExamList()
{
System.out.print("Welcome to the Exam Scores Program \n");
System.out.print ("\n");
}
void getScores()
{
Scanner input=new Scanner(System.in);
System.out.print ( "How many scores will you enter (up to 15):");
count = input.nextInt();
System.out.print ("\n");
while (count > MAX_SCORE)
{
System.out.print("Error: You may onlyenter upto 15 scores - Please try again:");
count=input.nextInt();
System.out.print ("\n");
}
list= new double [count];
for(int i = 0;i< list.length; i++)
{
System.out.println("Enter score " + (i+1) + ": ");
number = input.nextDouble();
list[i] = number;
}
}
void processScores(double number)
{
small = list [count];
for (double number : list)
{
if (number < small)
small = number;
}
large = list [count];
for (double number : list)
{
if (number > large)
large = number;
}
double total = 0;
for(double number : list)
total += number;
average = total/number;
}
void displayResults()
{
System.out.println("\nAverage Score = " + average);
}
}