Answered step by step
Verified Expert Solution
Question
1 Approved Answer
EGR 281-Project 13 due Wednesday, November 22 by 6:00 PM y.XX The study of enciphering and/or encoding (on the sending end) and deciphering and/or decoding
EGR 281-Project 13 due Wednesday, November 22 by 6:00 PM y.XX 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 Kpunt (kryptos), or hidden and 1 V (graph ia), 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 wil1 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 interface 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 EGR 281-Project 13 due Wednesday, November 22 by 6:00 PM y.XX 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 Kpunt (kryptos), or hidden and 1 V (graph ia), 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 wil1 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 interface 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
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