Question: Convert this C++ code to Java code the code below is to encrypt and decrypt strings of characters using Vigenere cipher the code has 4

Convert this C++ code to Java code

the code below is to encrypt and decrypt strings of characters using Vigenere cipher the code has 4 txt files

Convert this C++ code to Java code the code below is to

encrypt and decrypt strings of characters using Vigenere cipher the code has

4 txt files The C++ code: #include #include #include using namespace std;

The C++ code:

#include

#include #include using namespace std; //Class VigenereCipher class VigenereCipher { //Access specifier public: //Declare key string KeyValue; //Constructor to class VigenereCipher(string KeyValue) { //Use loop to check the size for (int it = 0; it = 'A' && KeyValue[it] KeyValue += KeyValue[it]; //check the alphabets else if (KeyValue[it] >= 'a' && KeyValue[it] KeyValue += KeyValue[it] + 'A' - 'a'; } } //Function to encrypt string encryptGenerate(string textVal) { //String inp string OutValue; //Use loop to check the length for (int it = 0, a = 0; it = 'a' && ch 'Z') //continue continue; //compute the result OutValue += (ch + KeyValue[a] - 2 * 'A') % 26 + 'A'; //assign key to check a = (a + 1) % KeyValue.length(); } //return the outvalue return OutValue; } //Function to decrypt string decryptGenerate(string textVal) { //A variable string OutValue; //for loop to checl length for (int it = 0, a = 0; it = 'a' && ch 'Z') //continue state continue; //compute the out value OutValue += (ch - KeyValue[a] + 26) % 26 + 'A'; //compute the result a = (a + 1) % KeyValue.length(); } //retrun the outvalue return OutValue; } }; //Program begins with main int main() { //create instance for class VigenereCipher cipherText("VIGENERECIPHER"); //declare a variable to load a string string text ; //Opens the input file ifstream infile("plain.txt"); //Opens the output file ofstream enfile("Encrypt.txt"); //Opens the output file ofstream defile("decrypt.txt"); //check the text while(infile>>text) { //reads from file infile>>text; cout decrypt,txt encrypt,txt a key tot plain. tot

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!