When I run this code, the lines after the while loop are never executed. I've done testing inside the loop itself, and as far as i can tell the loop itself is completing, the method just never moves on to the following line.
I am aware there are multiple similar topics, but most seem to reference proper string comparisons and infinite loops.
Example input for this would be:
Maria 1 2 3 4
Output should be:
Maria's GPA is 2.50.
Any help would be appreciated.
public static void printGPA(){
  Scanner console = new Scanner(System.in);
  String studentName = "";
  int counter = 0;
  int gpa = 0;
  System.out.print("Enter a student record: ");
  while (console.hasNext()){
    if (console.hasNextInt()){
      gpa += console.nextInt();
      counter += 1;
    } else {
      studentName = console.next();
    }
  }
  System.out.print(studentName + "'s GPA is ");
  System.out.printf("%.2f.", ((double)gpa / (double)counter));      
}


gpaorcountertodoublebefore the division; otherwise, the result will be truncated to integer.