Create a java application to prompt the user for a key and a phrase. After the i
ID: 641774 • Letter: C
Question
Create a java application to prompt the user for a key and a phrase. After the information is entered, encrypt the phrase using the provided key.
Validate the key. The absolute value of the key cannot be less than 1 or greater than 25. Prompt the user in a loop until a valid key is entered.
Put the code in a loop to continue prompting for more keys and phrases to encrypt.
Here is an example of how the program might appear
Enter a non-zero key value between -25 and + 25 3
Enter a phrase to encrypt A new game
Encrypted Phrase D qhz jdph
Do another word (yes/no) yes
Enter a non-zero key value between -25 and + 25 4
Enter a phrase to encrypt True Grit.
Encrypted Phrase Xvyi Kvmx.
Do another word (yes/no) yes
Enter a non-zero key value between -25 and + 25 -2
Enter a phrase to encrypt Hello
Encrypted Phrase Fcjjm
Do another word (yes/no)
Enter a non-zero key value between -25 and + 25 3
Enter a phrase to encrypt A new game
Encrypted Phrase D qhz jdph
Do another word (yes/no) yes
Enter a non-zero key value between -25 and + 25 4
Enter a phrase to encrypt True Grit.
Encrypted Phrase Xvyi Kvmx.
Do another word (yes/no) yes
Enter a non-zero key value between -25 and + 25 -2
Enter a phrase to encrypt Hello
Encrypted Phrase Fcjjm
Do another word (yes/no)
Explanation / Answer
For(int i=0;i<=string.length();i++)
{if(string.charAt(i)!=
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.