Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. It is quite interesting that most of us are likely to be able to read and comprehend words, even if the alphabets of these

1. It is quite interesting that most of us are likely to be able to read and comprehend words, even if the alphabets of these words are scrambled (two of them) given the fact that the first and last alphabets remain the same.

For example, I dn'ot gvie a dman for a man taht can olny sepll a wrod one way. (Mrak Taiwn) We aer all moratls, Hamrbee is an immoratl, and tehre is no question abuot it. (Kevin Unknown)

Write a method named scramble that returns a String and takes a String as an argument. The argument is actually a word (of length 6 or more). It then constructs a scrambled version of that word, randomly flipping two characters other than the first and last one. Then write the main method in which you would read the word from the user, send it to scramble, and print the scrambled word. You can use a loop to read multiple words if you like but it is not necessary. If the length of the entered word is less than 6, you should keep prompting the user to enter a valid word. After writing all the comments, generate a Javadoc and submit it with the java file.

Hint: First generate two random integers in range of the length of the string. Then use substring method to access characters at those locations. Rest is left to your imagination

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions