Question: Intro to Java We will begin working on a program that will be useful for the project. We will implement the Caesar cipher (Links to

Intro to Java

We will begin working on a program that will be useful for the project. We will implement the Caesar cipher (Links to an external site.)Links to an external site. (also called a shift cipher). The Caesar cipher is an encryption method that is thousands of years old, said to have been used by Caesar. It's a good introduction to encryption, the process of transforming a message into an encoded message that can only be read by its intended recipient(s) who have the ability to decode it.

Intro to Java We will begin working on a program that will

be useful for the project. We will implement the Caesar cipher (Links

For this assignment we can use Arrays of char to hold the regular alphabet or the shifted alphabet. Because the regular, unshifted alphabet is always ABDE.. we could alternatively store it in a string and use.indexof) and.charAt) to access its components. Either way will work fine for a program like this, and even if using arrays, it's very convenient to generate the array from the String "ABCDE...".We also must use .indexof) and.charAt() to access particular characters in Strings. There are ways to write this programming without using this approach, but we are learning about Strings this week, and these things are the subject matter. Create a program ShiftCipher (hand in ShiftCipher.java) which accomplishes the following: 1. Has a static method shiftAlphabet taking an integer argument (n returning the alphabet as an array of chars shifted by n. Note that calling this method with n should return the regular, unshifted, alphabet. ciphertext. plaintext. Note that decrypting with a value of n should be equivalent to encrypting with a value of -n (negative 2. Has a static method encryet which takes as argument a String Dlaintext and an int n returning a String of 3. Has a static method [decrypt which takes as argument a String ciphertext and an int n, returning a String of n). That might give you a very easy way to program the decrypt method If you feel comfortable writing this program, now's the time. If you'd like a few implementation hints, see the video below. If you need more hints after the video, head to the discussion forums, send me email, or come to office hours. The program's output is cropped by the video. Here is the code generate your own output. The three lines I use for output are from the video if you'd like to follow along and System . out . print1n(alphabetArray[(0-11 + 26) % 26]); // output is P System . out .printin(alphabet.charAt((0-11 + 26) % 26)); // output is System.out.println(alphabet.index0f ("L)) // output is 11 P Test your programming by encrypting a message and verifying you recover the original message upon decryption. Prompt the user to enter a plaintext message and an integral shift value. Your program should convert the message to uppercaseand output the ciphertext. Sample output is below: Please enter a plain text message for encryption: informatics Please enter the shift value (key) for the cipher: 3 The ciphertext is: LQIRUPDWLFV To verify, the decrypted encrypted text is below: INFORMATICS

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!