Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Security is an important feature of information systems. Often, text is encrypte

ID: 3557795 • Letter: S

Question

Security is an important feature of information systems. Often, text is encrypted before being sent, and then decrypted upon receipt. We want to build a class (or several classes) encapsulating the concept of encryption. You will need to test that class with a client program where the main method is located.

For this project, encrypting consists of translating each character into another character. For instance, if we consider the English alphabet, including characters a through z, each character is randomly encrypted into another, which could be the same character. (If you like, you can design your program so that no character is encrypted into itself). To represent this concept, we can have an array of characters for the original alphabet, and another array of characters for the encrypted alphabet.

To encrypt a word, each letter in the word is replaced by the corresponding letter in the encrypted alphabet. To decrypt a word, the letters in the encrypted are replaced by the corresponding letter in the original.

If we have 26 different characters in the original alphabet, then we have 26 in the decrypted. Furthermore, the encrypted alphabet should be randomly generated (REALLY having the hard time here).

In your main method, you should prompt the user for a sentence. Your program should encrypt the sentence, output the encrypted sentence, then decrypt it, and out the decrypted.

****I have the following so far****

import java.util.Scanner;
import java.util.Random;

public class encryption

{          private static final char[]origAlpha={'A','B','C','D','E','F','G','H', 'I', 'J','K','L','M', 'N','O','P','Q','R','S','T','

U','V','W','X','Y','Z'};

private static final char[]encryptAlpha={'W','J','L','S','V','A','R','G','O','C','I','N','T','U','Y','Z','F','D','M','P','B','H','X','Z','Q','E'};

Explanation / Answer

public class MainClass { public static final int ALPHASIZE = 26; public static final char[] Lalpha = { 'a','b','c','d','e','f','g','h','i','j','k','l', 'm','n','o','p','q','r','s','t','u','v','w','x','y','z' }; public static final char[] Ualpha = {'A','B','C','D','E','F','G','H','I','J','K','L', 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', }; protected static char[] encryptU = new char[ALPHASIZE]; protected static int[] decrypt = new int[ALPHASIZE]; protected static char[] encryptL = new char[ALPHASIZE]; Random rgenerator = new Random(); public MainClass(){ int randNum = rgenerator.nextInt(ALPHASIZE); for(int i=0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote