Question: How can I write algorithm for encoder method and decoder method that take cipher text and number for how the letter is far from the

How can I write algorithm for encoder method and decoder method that take cipher text and number for how the letter is far from the original "in java" i that what i use in both of them

for(int i = 0; i < message.length(); i++){ switch(message.charAt(i)){ case ' ': encMessage += ' '; break; case '.': encMessage += '.'; break; case ',': encMessage += ","; break; case '!': encMessage += "!"; break; case '?': encMessage += "?"; break; default: charPos = alphabet.indexOf(message.charAt(i)); keyVal = (number + charPos) % 26; if(keyVal<0){ keyVal=alphabet.length() +keyVal;} encVal = alphabet.charAt(keyVal); encMessage += encVal; break;

"with some changes in decoder"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!