Question: Given two classes: public class EncryptionRunner { public static void main ( String [ ] args ) { / / Creates a 2 D array
Given two classes: public class EncryptionRunner
public static void mainString args
Creates a D array of letters that make up a password
String password alg
ori
thm;
Calls the Encryption object
Encryption encrypt new Encryptionpassword;
encrypt.swapLetters;
System.out.printlnencryptpasswordToString;
public class Encryption
private String letters; The D array of letters that make up the password
Initializes letters to the D array of letters
public EncryptionString letters
this.letters letters;
Returns the D array of letters
public String getLetters
return letters;
Swaps the letter at row column with the letter at
row column and swaps the letter at row column
with the letter at row colum'n
public void swapLetters
Returns a String containing each letter in letters
public String passwordToString
String result ; for int row ; row letters.length; row
for int col ; col letterslength; col
result lettersrowcol;
return result;
In the Encryption class, write the swapLetters method to perform a diagonal swap of the letters in the D array letters. The swapLetters method should:
Swap the letter at with the letter at
Swap the letter at with the letter at
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
