import java.util.*;
public class Grades
{
public static void main(String[] args) {
int max = 100;
int min = 60;
int l = 20;
double high = 0;
double low = 100;
double[] grades = new double[l];
double total = 0;
System.out.println(" ");
for(int i = 0; i < l; i++){
int rand = (int)(Math.random() * ((max - min) + 1)) + min;
grades[i] = rand;
total += grades[i];
if(grades[i]>high){
high = grades[i];
}
if(grades[i]<low){
low = grades[i];
}
System.out.println("#" + (i+1) + ": " + grades[i]);
}
double average = (total/l);
System.out.println("High: " + high);
System.out.println("Low: " + low);
System.out.println("Average: " + average);
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.