Question: Create a new project called ManipulatingStrings in a lab06 folder and create a class in it called 'String Scrambler'. Step 2: Within StringScrambler class,



Create a new project called ManipulatingStrings in a lab06 folder and create 

a class in it called 'String Scrambler'. Step 2: Within StringScrambler class,

Create a new project called ManipulatingStrings in a lab06 folder and create a class in it called 'String Scrambler'. Step 2: Within StringScrambler class, declare one instance variable type string. Name it 'word' Step 3: Write these four methods in the class: - public String scrambleFirstLast() - public String scrambleSecond Third() - public String scrambleAdjacentTwo(int index) - public String scrambleNotAdjacentTwo(int index) Step 4: Complete the method scrambleFirstLast(): This method will return a string where the first character and the last character of the String word. It shouldNOT modify the word as it is stored in the StringScrambler object. Additionally, if the word is less than 2 characters, the method should return NULL. It should return a string made up of: The last character of word All but the first and last characters of word // Could be empty The first character of word For example, If word="apple" Then the method should return eppla If word = hi Then the method should return ih If word = Q Then the method should return null // not the word null, return a null pointer *There are multiple ways to do this including the usage of: Substring charAt Step 5: Complete the method scrambleSecondThird(): It should return a word where the second and third letters are swapped. The first character of word The third character of word The second character of word The rest of the word // may be empty Just like the last method you implemented, you should return null if there are not enough letters. Step 6: Complete method scrambleAdjacent Two(): This method takes the input int x, where x is the INDEX of the character they want to swap. It swaps with the character at x+1. So if the word was 'hello' and you sent scrambleAdjacentTwo(1). The return would be hlelo Step 7: Complete method scrambleNotAdjacentTwo(): This method takes the input int x, where x is the INDEX of the character they want to swap. It swaps with the character at x+2 // notice the difference So if the word was 'hello' and you sent scrambleAdjacentTwo(2). The return would be heoll

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Below is the Java code for the specified requirements java public class StringScrambler private Stri... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!