Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started