Question
The study of enciphering and/or encoding (on the sending end), and deciphering and/or decoding (on the receiving end) is called cryptography from the Greek (kryptos),
The study of enciphering and/or encoding (on the sending end), and deciphering and/or decoding (on the receiving end) is called cryptography from the Greek (kryptos), or hidden and (graphia), or writing. If you don't know Greek (and not many of us do) the above letters could be a form of code themselves! To start, we will need to 2 interfaces.
First, a simple interface MessageEncoder that has a single abstract method encode(plainText), where plainText is a String object that contains the message to be encoded. The method will return a String object which contains the encoded message.
Second, a simple interface MessageDecoder that has a single abstract method decode(cipherText), where cipherText is a String object which contains the message to be decoded. The method will return a String object which contains the decoded message.
Now, ciphers are broken into two main categories: substitution ciphers and transposition ciphers. Substitution ciphers replace letters in the plaintext with other letters or symbols, keeping the order in which the symbols fall the same. Transposition cipherskeep all of the original letters intact, but mix up their order. The resulting text of either enciphering method is called the ciphertext. Of course, you can use both methods, one after the other, to further confuse an unintended receiver as well. To get a feel for these methods, let's take a look at some ciphers.
Need this is Java
Create a class SubstitutionCipher that implements both the interface MessageEncoder and MessageDecoder. The constructor shouldhave one int parameter called shiftBy. Define the method encode so that each letter is shifted by the value of the parameter shiftBy. For example, if the shiftBy is 3, a will be replaced by d, b will be replaced by e, c will be replaced by f, and so on. Hint: You may wish to define a private method that shifts a single character. In addition, the class will have a decode method which will appropriately decode the message by the value of the parameter shiftBy.
Create a class TranspositionCipher that implements the implements both the interface MessageEncoder and MessageDecoder. The constructor should have one int 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. In addition, the class will have a decode method which will appropriately decode the message by the value of the parametern.
For project 13, you will create a total of at least six different files. (2 Interfaces, 2 Classes, 1 GUI Class, 1 Driver Class)
Finally, write a CipherGUI (JavaFX) that with appropriate prompts allows a user to enter either messages to encode (plaintext) ormessages to decode (ciphertext). It will display the appropriate corresponding output and a driver program CipherDriver.
Extra Credit: Include in your comments, what the name of the project by decrypting it from the stick figures.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started