import java.util.Scanner;
public class Quera {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("How many students do you have?");
int n = scanner.nextInt();
for (int i = 0 ; i < n ;i++){
System.out.println("Enter their names and the number of courses in order :");
String student1 = scanner.next();
int course = scanner.nextInt();
System.out.println("Enter her\\his scores : " );
long[][] scores = new long[n][];
scores[i] = new long[course];
for(int x =0 ; x < course ; x++){
int score = scanner.nextInt();
}
System.out.println(scores[i]);
}
}
}
This is what I'm trying to do:
A java program that first takes the number of students from the user. Then for each student, first asks student's name and the number of courses, and takes the grades of each lesson from the user and stores all the students' grades in an unbalanced two-dimensional array. Print the average grades of different students. At the end, print the details of the first grade student along with his grade point average.
I tried many ways but I keep getting array out of bounds exception.