Create a class ShuffleCipher that implements the interface MessageEncoder, as described in Exercise 15. The constructor should have one parameter called n. Define the method encode so that the message is shuffled n times. To perform one shuffle, split the message in half and then take characters from each half alternately. For example, if the message is “abcdefghi”, the halves are “abcde” and “fghi”. The shuffled message is “afbgchdie”. Hint: You may wish to define a private method that performs one shuffle.

What will be an ideal response?


See the code in ShuffleCipher.java.

Computer Science & Information Technology

You might also like to view...

To create an elongated bottom-left corner, you could apply the style ____, which would set the horizontal radius of the bottom-left corner to 150 pixels and the vertical radius to 80 pixels.

A. border-bottom-left-radius: 150px 80px; B. border-bottom-left-radius: 80px 80px; C. border-bottom-left-radius: 150px 150px; D. border-bottom-left-radius: 80px 150px;

Computer Science & Information Technology

Which cpio utility mode extracts files from an archive?

A. copy-out B. copy-in C. copy-pass D. copy-through

Computer Science & Information Technology

Remove a table from the Query window by right-clicking in the field list and choosing delete table. ___________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The cast operator has the syntax ____.

A. (dataType expression) B. (expression dataType) C. (dataType) expression D. expression (dataType)

Computer Science & Information Technology