I am running into an error with NoSuchElementException,
Please help!
Here is the error:
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:838)
at java.util.Scanner.next(Scanner.java:1461)
at java.util.Scanner.nextInt(Scanner.java:2091)
at java.util.Scanner.nextInt(Scanner.java:2050)
at Project.answerKey(Project.java:292)
at Project.findMyAvg(Project.java:344)
at Project.printMyResults(Project.java:269)
at Project.printHeader(Project.java:203)
at Project.main(Project.java:30)
The code at line 292 is:
answer[count] = inScan.nextInt();
the method is:
public static int[] answerKey()
{
int[] answer = new int[11];
for (int count = 0; count <= 10; count++)
{
answer[count] = inScan.nextInt();
}
return answer;
}
The code at line 344 is
int[] answer = answerKey();
The code at line 269 is
System.out.println("Class Average (%) = " + findWHSAvg() + "%");
Please help me
Ask if you need to know more, please help.