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
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