Question: Write a program that performs text encryption and decryption on a certain input string. First, ask the user to input a string. Then, ask the
Write a program that performs text encryption and decryption on a certain input string.
First, ask the user to input a string. Then, ask the user for an encryption parameter, between 1 and 30.
Write a separate Class named EncryptionHelper. This class has a static function called Encrypt. This function accepts a String parameter, and an integer parameter.
The Encrypt function iterates over each character of the input string that is passed to it. It converts each character to it's corresponding integer value in the ASCII table, and then subtracts the given encryption parameter from that number. Finally, the resulting number is converted back to a char and the sequence of characters is put together to create the encrypted string.
The class Encryption Helper should also provide a function called Decrypt. This function also accepts a string and an integer parameter, and reverses the process, to create clear text out of an encrypted string.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
