Hey I posted earlier a few days ago about a program I am having trouble with. Well I have worked on it but still need a little bit of help. I have to write a program that will store 10 grades into an array. The program will need to output the lowest, highest, and average grade here is what I got so far. I am stuck and dont know how to get this to work. Thanks for any help.
//Arrayofscores.java
public class Arrayofscores
{
public static void main(String args[])
{
int [] scores = new int[10];
int smallest, highest,total=0;
double average =0.0;
//enter 10 scores
for (int i = 0;i<= scores.length-1;i++)
{
System.out.print("Enter Score " + (i+1) + ": ");
}
//lowest score
smallest = scores[0];
for (int i = 1; i <= scores.length-1;i++)
if (scores < smallest)
smallest = scores;
System.out.println("The lowest score is : " + smallest);
//highest score
highest = scores[0];
for (int i = 1; i <= scores.length-1;i++)
if (scores > highest)
highest = scores;
System.out.println("The highest score is : " + highest);
//average score
for (int i = 0; i<=scores.length-1;i++)
total = total + scores;
average = total/10.0;
System.out.println("\nThe average score is : " + average);
}
}