Question
Please help me write this Java program. I had posted this question before, but got an answer that was totally wrong. We are using the
Please help me write this Java program. I had posted this question before, but got an answer that was totally wrong. We are using the latest version of Java8. Thank You!
--------------------------------------------------------------------------------------
Write a Java program that can successfully DECRYPT a string inputted by the user which has been encrypted using a Caesar Cipher with a unknown shift value(key).
You can use brute force to do a for loop through all the 26 shift values, however, your program should only return the CORRECT decrypted string and not all the other incorrectly decoded strings.
Your program should be case sensitive and should include the foreign characters (such as commas, puncuation marks, etc.) as they were located in the encrypted text. You are to only decrypt the letters of the alphabet (a-z), all other characters should stay as they are. Your program should work for all shift values up to and including 26, and then print the correctly decoded string.
--------------------------------------------
An Example run would be:
--------------------------------------------
Enter Encoded Text: Czxafepc Sntpynp, td lmzgp lww, esp rcplepde! Decoded Text is: Computer Science, is above all, the greatest!
-------------------------------------------
Another Example run would be:
--------------------------------------------
Enter Encoded Text: Iw yv yru repkyzex tfewzuvekzrc kf jrp, yv nifkv zk ze tzgyvi, kyrk zj, sp jf tyrexzex kyv fiuvi fw kyv cvkkvij fw kyv rcgyrsvk, kyrk efk r nfiu tflcu sv druv flk. Decoded Text is: If he had anything confidential to say, he wrote it in cipher, that is, by so changing the order of the letters of the alphabet, that not a word could be made out.
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