help.. what to do with this?
Hi,
I'm a newbie here and I need some help.
Problem:
Create a two-dimensional array program to store student grades on multiple exams. This is used by a professor to store and analyze a set of student grades. Each row of the array represents a single student's grades for the entire course, and each column represents a grade on one of the exams the students took during the course.
The output should be:
***Input Grades***
Student1
Test1: 87
Test2: 96
Test3: 70
Student2
Test1: 68
Test2: 87
Test3: 90
.......
.......
.......
.......
***Summary***
The Grades are:
________Test1__Test2__Test3__Average
Student1:__87___96_____70_____84.33
Student2:__68___87_____90_____81.67
Student3:__94___100____90_____94.67
Student4:__100__81_____82_____87.67
.......
.......
.......
Lowest grade: 68
Highest grade: 100
Overall grade distribution:
50-59:
60-69: *
70-79: *
80-89: ****
90-99: ****
100: **
And here's what I came up with...
Code:
import java.io.*;
public class StudentGrades{
public static void main(String[]args)throws Exception{
DataInputStream k=new DataInputStream(System.in);
int grade[][]=new int [10][4];
float ave[]=new float [10];
int i, j;
float a=0;
System.out.println("\n***Input Grades***");
for (i=0;i<10;i++){
System.out.println("Student "+(i+1));
for (j=1;j<4;j++){
System.out.print("Test "+j+" ");
grade[i][j]=Integer.parseInt(k.readLine());
if (grade[i][j]>100){
do{
System.out.println("Grades CANNOT exceed 100, re-enter...");
System.out.print("Test "+j+" ");
grade[i][j]=Integer.parseInt(k.readLine());
}while (grade[i][j]>100);
}
else
a=a+stud[i][j];
}
ave[i]=a/3;
a=0;
}
System.out.println("\n***Summary***\n");
System.out.println("\t\tTest1\tTest2\tTest3\tAverage");
for (i=0;i<10;i++){
System.out.print("Student "+(i+1)+"\t");
for(j=1;j<4;j++){
System.out.print(stud[i][j]+"\t");
}
System.out.println(ave[i]);
}
}
}
and my real problem comes here:
How do I get the Lowest & Highest grades and that overall distribution thingy?
I know its a long problem, but please, someone help me. :(