public class program {
public static void main(String[] args) {
// Establishes the rows and columns in the arrays,
// along with the average grades.
int students = 0, tests = 0;
int sum = 0;
// Establishes an array for student names, test grades and averages, and
// the final letter grade.
int grade[][] = new int[25][3];
String student[] = new String[25];
double low=100;
double high=0;
double low1[]={100,100,100} ;
double high1[]={0,0,0} ;
// This allows to set the number of students and test grades that you can enter.
System.out.println("Please enter the number of students you want to enter(1-25): ");
students = EasyIn.getInt();
System.out.println("Please enter the number of test subject grades (1-3): ");
tests = EasyIn.getInt();
System.out.println();
// This allows you to enter the student name, and their test grades.
for( int x = 0; x < students; x++){
System.out.println("Student Name: ");
student[x] = EasyIn.getString();
for(int y = 0; y < tests; y++){
System.out.println("Test Grade " +(y + 1) +": ");
grade[x][y] = EasyIn.getInt();
if (low1[x] > grade[x][y])
{
low1[x] = grade[x][y];
}
if (high1[x] < grade[x][y])
{
high1[x] = grade[x][y];
}
sum += grade[x][y];
if (grade[x][y] < low)
low = grade[x][y];
if (grade[x][y] > high)
high = grade[x][y];
}
// Determines grade letter from the average score of each student.
grade[x][tests] = sum/tests;
sum = 0;
System.out.println();
}
// Out
System.out.printf("%-10s","Student Name" + "\t");
for(int y = 0; y < tests; y++){
System.out.printf("%-10s", "Test " + (y + 1));
}
System.out.println(" Average Grade lowest grade");
for(int q = 0; q < students; q++){
System.out.printf("%-12s", student[q]);
for(int w = 0; w < tests; w++){
System.out.printf("%10.2f", grade[q][w]);
}
System.out.printf("%12.2f", grade[q][tests]);
System.out.printf("%16s", low1[q]);
System.out.printf("%13s", high1[q]);
System.out.println();
}
//
String search_name;
System.out.printf("Please enter student Name to search for: ");
search_name = EasyIn.getString();
for(int q = 0; q < students; q++){
if (student[q].equals(search_name))
{
System.out.printf("Student Name: %s \n", student[q]);
for(int r = 0; r < tests; r++)
{
//System.out.printf("%10.2f", grade[q][r]);
System.out.printf("\n Test %d : Mark : %.2f ",r + 1 , grade[q][r]);
}
System.out.printf("\n\n Lowest mark by %s in all tests : %.2f \n Highest mark by %s in all tests %.2f \n",search_name, low1[q],search_name,high1[q]);
}
//
}
//
System.out.printf("\n\n Lowest overall mark by any student in all tests : %.2f \n Highest overall mark by any student in all tests %.2f \n",low,high);
}
///