I have this code:
int[][] stuGrades = {{97, 64, 75, 100, 21}}; //extract from data file
String[][] HWdata; // original data file
for (int g = 0; g < stuGrades.length; g++) {
for (int p = 0; p < stuGrades[0].length; p++) {
int tempScores = stuGrades[g][p];
if (tempScores <= 100 && tempScores > 98.1) {
stuGpa[g][p] = 4.0;
}
else if (tempScores <= 98 && tempScores > 96.1) {
stuGpa[g][p] = 3.9;
}
}
}
My goal is to convert the grades array {97, 64, 75, 100, 21}
to a new GPA array, which will convert the score to 4.0, 3.9 or something else. I got this error:
Exception in thread "main" java.lang.NullPointerException at homework7.main.
How can I resolve this issue?