This may be very stupid. I am a beginner, but for some reason my for loop will output the two print statements next to each other for the first loop without accepting user input. On the second loop, the loop works properly.
public static void fleschTest(Scanner key, int numPieces) {
String textInput = "";
for(int i = 1; i <= numPieces; i++) {
System.out.print("\nPlease enter text sample number " + i + ": ");
textInput = getText(key);
System.out.println("Statistics for this text: " + textInput);
}
}
This is the method being called in fleschTest.
public static String getText(Scanner key) {
String textInput = key.nextLine();
return " " + textInput;
}
Current output: if number or text samples is 2. Please enter text sample number 1: Statistics for this text:
Please enter text sample number 2: (user input)
Statistics for this text: (user input)