Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class Caeser { public static final String alphabet= absdefghijklmnopqrstuvwxyz; public static final String key = defghijklmnopqrstuvwxyzabc; public static void main(String[] args) {

public class Caeser {

public static final String alphabet= " absdefghijklmnopqrstuvwxyz";

public static final String key = " defghijklmnopqrstuvwxyzabc";

public static void main(String[] args) {

String phrase = " The dog dayz are over";

}

public static String encrypt(String plain) {

String cipher = "";

return cipher;

}

}

image text in transcribed

4. String problem solving (25%) Download the program shell called Caeser.java. The intention for the program is to encrypt phrases consisting of letters and whitespaces using Caesar's cipher. Cease's cipher is the type of a substitution cipher in which each letter in the plaintext is replaced by a letter from the key. For example, if the first row in the table below represents the alphabet and the second one represents the key, then the phrase such as "The dog dayz are over", will become "xlidhskdhec devidsziv" In main, create a string variable plaintext, read a word into it, change it to lowercase, and pass it to the method that encrypts it using the alphabet and the key. Think how you can use String methods you learned about to do so. The method should return the encrypted version that is to be printed to the console from main. The algorithm is for each plaintext character, find the index of that character in alphabet use the index to find the substitution letter in key append the key letter to the cipher variable Only the brave: if you feel brave today, you can try to figure out how to use the Scanner object to read more than one word-you will need a loop for that but since Java is a bit weird in its processing of a line, this is an optional part. - THE END

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

Students also viewed these Databases questions