Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

String Encrypt = \"Encryption\"; String Decrypt = \"Decryption\"; System.out.pri

ID: 3619484 • Letter: S

Question

String Encrypt = "Encryption";
String Decrypt = "Decryption";
System.out.println("Do you want to do Encryption or Decryption?");
Scanner sc = new Scanner(System.in);
String selection = sc.next();
while((!selection.equals(Encrypt)) || (!selection.equals(Decrypt)));
{
System.out.println("Do you want to do Encryption or Decryption?");
selection = sc.next();
}
I want the program NOT to continue unless "selection" is equal to "Encrypt" or "Decrypt". How do I make "Encrypt" and "Decrypt" case insensitive?
String Encrypt = "Encryption";
String Decrypt = "Decryption";
System.out.println("Do you want to do Encryption or Decryption?");
Scanner sc = new Scanner(System.in);
String selection = sc.next();
while((!selection.equals(Encrypt)) || (!selection.equals(Decrypt)));
{
System.out.println("Do you want to do Encryption or Decryption?");
selection = sc.next();
}
I want the program NOT to continue unless "selection" is equal to "Encrypt" or "Decrypt". How do I make "Encrypt" and "Decrypt" case insensitive?
How do I make "Encrypt" and "Decrypt" case insensitive?

Explanation / Answer

} //note that java is case sensitive ...so you should give the exact same string as Input