Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions