Question: Write a program that generates scrambled from one or more words provided by the user Step 1: Input You will prompt the user to enter
Write a program that generates scrambled from one or more words provided by the user Step 1: Input You will prompt the user to enter a word to be scrambled. Step 2: Calculation. Write a method private static String Scramble (String word) that constructs a scrambled version of a given word, randomly flipping two characters other than the first and last one. Helpful hints: We can use the substring method to help us change the value of a character in a string. For example, let's say we want to change the 5 character (i.e, the character at index 4) of myName to the character x: String myiae "aymond": myNane-EyNane.substring (0,4)+'1% rysame.zubatring (5); step 3: Output. The program will print out the scrambled version of the word provided by the user, and then prompt the user to enter another word If the user is finished, they can indicate that they are ready to stop the program. If the user wants to continue entering words to scramble, the program should loop back to Step 1 Example program run: Enter a word to scramble: pickle Scrambled word: pkcile Would you like to enter another word to scramble? (Y/N) Invalid response: y Would you like to enter another word to scramble? (Y/N) Enter a word to scramble: Scranbled word: a Would you like to enter another word to scramble? (Y/N) Invalid response: do Would you like to enter another word to scramble? (Y/N) Enter a word to scranble: dog Scranbled word: dog Would you like to enter another word to scramble? (Y/N) Enter a word to scranble: dogs Scranbled word: dgos Would you like to enter another word to scramble? (Y/N) Enter a word to scramble: Orlando Scrambled word: Oralndo Would you like to enter another word to scramble? (Y/N) Word Scramble
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
