ShiftCipher.javavoid encrypt(char[] msg, int shift)void decrypt(char[] msg, int shift)c with the following:
(char)((c - 65 + shift) % 26 + 65)c with the following:
(char)((c - 65 - shift + 26) % 26 + 65)encrypt and
decrypt.
main function for ShiftCipher.java
should contain a well thought out unit test for encrypt and
decrypt.Encrypt.javaScanner's nextLine() function, not any
loops.encrypt function, remember you have to convert
the message to a char[] (toCharArray() in
String).Decrypt.javadecrypt function, remember you have to convert
the message to a char[] (toCharArray() in
String).| Input: | $ java ShiftCipher |
| Output: | (this is specific to your unit test) |
| Input: | $ java Encrypt msg.txt |
| Output: | (user enters information when prompted) |
Please enter a message: HELLO THERE
msg.txt contains: KHOOR WKHUH
|
| Input: | $ java Decrypt msg.txt (msg.txt contains KHOOR WKHUH) |
| Output: | (user enters information when prompted) |
Please enter a shift: 3
|
String. The String is input as a command-line
argument and output to the terminal in the main function. Name the file and
program ch2sec3prob00.java. Worth 20pts. Use only
length(), substring(), and charAt()
from String. The recursive function is ~3
lines of code and main is ~1 line of code.
| Input: | $ java ch2sec3prob00 Hello |
| Output: | olleH |
ch2sec3prob01.java.
Worth 20pts. The recursive function is ~6
lines of code and main is ~2 line of code.
| Input: | $ java ch2sec3prob01 10 |
| Output: | 1010 |