Just change this part.
System.out.print("Enter time in hours (space), minutes (space), and seconds: ");
hours = sc.nextInt();
sc.next();
minutes = sc.nextInt();
sc.next();
seconds = sc.nextInt();
sc.next();
Then your program works OK.
Time converter
Enter time in hours (space), minutes (space), and seconds: 5 hours, 10 minutes, 12 seconds
Total seconds are: 18612
Continue? (y/n): y
Enter time in hours (space), minutes (space), and seconds: 3 hours, 10 minutes, 20 seconds
Total seconds are: 11420
Continue? (y/n): n
But this is kind of error-prone. I would rather read the whole big string
which the user enters e.g. "5 hours, 10 minutes, 20 seconds" and then
extract whatever I need from there (and I would need just the 3 numbers).
What is it error-prone? Because if the user types "5 hours , 10 minutes , 20 seconds",
it will still detect this as invalid input (as the commas are not glued to the words).