EGR 281 - Project 2 due Tuesday, September 7 EGR 281 - Project 14 INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/E.png" \* MERGEFORMATINET INCLUDEPICTURE...

Project file attached.


EGR 281 - Project 2 due Tuesday, September 7 EGR 281 - Project 14 INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/E.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/C.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/R.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/E.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/T.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/A.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/N.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/G.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/U.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/A.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/G.png" \* MERGEFORMATINET INCLUDEPICTURE "http://www.dcode.fr/tools/dancing-men/images/E.png" \* MERGEFORMATINET 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 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 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 ciphers keep 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. Create a class SubstitutionCipher that implements both the interfaces MessageEncoder and MessageDecoder. The constructor should have 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 parameter n. For project 14, 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 (JFrame) that with appropriate prompts allows a user to enter either messages to encode (plaintext) or messages 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. Don’t forget to include your name, the project number, the due date, the current date and a short description of the program comments at the top of your program file. Also be sure to use good variable names. Also turn in a printed copy of your code.
Nov 26, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here