Question: IN JAVA PLEASE MAKESURE CODE WORKS WITH BOTH UPPERCASE AND LOWERCASE LETTERS. Background: For this assignment, you will code a simple encryption application. The application
IN JAVA PLEASE MAKESURE CODE WORKS WITH BOTH UPPERCASE AND LOWERCASE LETTERS.
Background: For this assignment, you will code a simple encryption application. The application encrypts words by mapping a list of the twenty-six alphabetic characters to a list of twenty-six corresponding symbols using the lists indices. 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 0 1 2 3 4 1 # $ symbols list > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 a b c d e f g h j k l m n o p q r s t u v w x y z alphabets list For example, the word Elvis, would encrypt as follows: E-> 1 -> + V ->; i >) s-> So, Elvis would encrypt to: 1+:)] Your task: You will start with the following class definition: C# Java using System; using System.Collections.Generic; import java.util.Scanner import java.util.ArrayList; class Encryption class Encryption List char symbols = new List char(); List0; public Encryption public Encryption symbols.Add("i"); symbols.Add: symbols. Add symbols.Add(s): symbols.Add(); symbols.Add('&'); symbols.Add(") symbols.Add(0); symbols.Add(% symbols.Add(): symbols. Addc-: symbols.Add(): symbols.Adde symbols.Add("); symbols.Add(): symbols.Add(0); symbols.Add(): symbols.Add(t): symbols.Add(t): symbols.Add(); symbols.Add(): symbols.Add(:: symbols.Add(: symbols.Add(); symbols.Add(): symbols.Add: symbols.add( symbolsadaran symbols addren symbols add(s); symbolsador: symbols add("&"). symbols.add(); symbols.add(0); symbolsaddo symbols add symbols.add(: symbolsadde symbolsada: symbols.add(7) symbolsada: symbols.adaro: symbols.add("% symbolsada symbols.add() symbols.add( symbols add symbolsada: symbols add symbols.add(); symbols.add(): symbols.add> for(char lettere letter letter++) for(char letterlatterletter--+) alphabets.add(letter) alphabets.Add(letter) 1 > ) 1 This creates two lists (2 ArrayLists in Java, and 2 Lists in C#). The first list contains twenty-six symbols (i.e. -@.#.$,%, etc.), one symbol in each cell. The second list contains the twenty-six lower case letters of the alphabet (az), one letter in each cell. From there you'll create the following six (6) methods: 1) Add a method return_alphabet, which takes in an int (integer) and returns the alphabet stored at that position, i.e. 5 would return f 2) Add a method return_alphabet_index, which takes in an alphabetic character (char) and retums the index (int) of the character in the alphabets list, i.e. a would retum 0b would retum 1. 3) Add a method return_symbol, which takes in an int (integer) and returns the symbol stored at that position, i.e. 5 would return & 4) Add a method return_symbol_index, which takes in a symbol (char) and returns the index (int) of the symbol in the symbols list, i.e. I would return 0, @ would retum 1. 5) Add a method encrypt_message, which takes in a plain-text string and returns the encrypted version of that string, i.e. Dwags would return $:!") The method should convert the plain-text string to lowercase (hint: Java: toLowerCase(), C#: Tolower()) The method should process each character in the plain-text string individually, encrypting each character and building a new string of encrypted characters (hint: Java: to CharArray(), C# ToCharArray(), return_alphabet_index(). retum_symbol()) If an invalid alphabet character is found, the following string should be retumed: "Error: Invalid Character 6) Add a method decrypt_message, which takes in an encrypted string and returns the decrypted version of that string, i.e. $:!*) would retum dwags The method should process each symbol in the encrypted string individually, decrypting each symbol and building a new string of decrypted characters (hint: Java: toCharArray(), C#: ToCharArray(), return_symbol_index(). return_alphabet()) If an invalid symbol is found, the following string should be returned: "Error. Invalid Symbol Driver Program: Create an object of the class Encryption Prompt the user with the following menu: 1 Encrypt a message 2 Decrypt a message 3 Quit Enter Choice If the user enters 1. prompt the user to enter a message, pass the result to the encrypt_message method, and print the returned oncrypted string, if the user enters 2 prompt the user to enter an encrypted message, pass the encrypted message to the decrypt_message method, and print the returned decrypted string If the user enters 3, terminate the program If the user enters any character other than a 1, 2 or 3, the following error message should display: Error. Please enter valid input, and the user should be allowed to roenter a valid choice Sample Output: 1 Encrypt a message 2 Decrypt a message 3 Quit Enter Choice 1 Enter the plain text message: May TheForceBeWith You Encrypted Mug: =