Question: If all three options are selected then option 1 is done first, followed by option 2 and then option 3. If only option 1 and

If all three options are selected then option 1 is done first, followed by option 2 and then option 3. If only option 1 and 3 are selected then option 1 is done first followed by option 3.

public static String encrypt(String x, int key, int factor) {

String new_x = "";

for (int i = 0; i < x.length(); i++) {

new_x += (char) (x.charAt(i) * factor);

}

return new_x;

}

public static String encrypt(String x, int key, int factor, boolean reverse) {

String new_x = "";

for (int i = 0; i < x.length(); i++) {

new_x += (char) (x.charAt(i) * factor);

}

return new StringBuilder(new_x).reverse().toString();

return new_x;

}

}

public static String decrypt(String y, int key, int factor)" { String x = ""; for (int i = 0; i < y.length(); i++){ char c = (char) (y.charAt(i) / factor - key); x = x + c; } return x;

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 Programming Questions!