Using this code
System.out.println("New Mark Entry\n--------------" + "\n\nEnter the description (up to 40 characters will be displayed):");
name = TextIO.getlnString();
if (name.length() > 40) {
name = name.substring(0,40);
}
System.out.println("What was the assignment out of?");
totalMark = TextIO.getlnDouble();
System.out.println("What was the students mark?");
mark = TextIO.getlnDouble();
System.out.println("What was the weight of this assignement?");
weight = TextIO.getlnDouble();
input = 1;
int openSpot = 0;
for(int i = 0; i < markbook.length; i++) {
if(markbook[i].getAssignment(name) == null) { // java.lang.NullPointerException is thrown here
openSpot = i;
break;
}
}
markbook[openSpot] = new Mark(name, totalMark, mark, weight);
break;
Causes a java.lang.NullPointerException to be thrown. Im a tad confused at what to do to fix this. If anyone could help or point me in the right direction it would be greatly appreicated