0

When I type quit, the program doesn't show the option to repeat the process with the message "Do you want another go? " That's the only issue I have.

        System.out.println("Please enter a word besides quit unless you want end the program ");
        word = keyboard.next().toLowerCase();
        while (!(word.equalsIgnoreCase("quit")))
        {
            combined = ""; 
            flipped = "";  
            firstLetter = word.charAt(0);
            remaining = word.substring(1);
            combined = remaining + firstLetter;
            for (i=combined.length()-1;i>=0;i--)
               {
                   flipped+=combined.charAt(i);
               }
            if (word.equals(flipped))
               {
                  System.out.println(word + " works");
               }
               else
               {
                   System.out.println(word + " does not work");
               }
               word = keyboard.next().toLowerCase();
        }
        System.out.println("Do you want another go? ");
        input = keyboard.nextLine(); 
        }while (input.equalsIgnoreCase("yes"));
    }
} ```
  • **change** `input = keyboard.nextLine();` **to** be: `input = keyboard.next();`. I'm sure it's there but just in case, make sure the `do {` is at the top of it all for the last `while` condition (your sample code does not show it). – DevilsHnd Mar 23 '22 at 07:56

0 Answers0