In JAVA how do you encode and print each sentence in the file using a basic Caesar Cipher.
- Encode the characters by shifting their Unicode value by 5
- For example if we encoded the character 'A' with a shift of 5 it would become the character 'F'
- For example if we encoded the character 'X' with a shift of 5 it would become the character ']'
- Spaces should be printed but not encoded
- Use the method caesarCipher
Write each encoded sentence to a new text file called encoded.txt
- If a IOException is thrown catch the exception and alert the user of the error
- Use the method encodedFile
(The main method cannot be set to throw any exceptions. The text file will contain multiple lines
and each line will correspond to a single sentence.)
Sample Output:
Ex: If input is:
anexample.txt
the output is:
Please enter the name of the file:
It tw it sty1 ymjwj nx st yw~&
Qnkj nx f qtsl qjxxts ns mzrnqny~3
Ex: If input is:
anexample2.txt
the output is:
Please enter the name of the file:
Mjqqt Qnq~1 ~tz itnsl |jqqD
N,r knsj&&&&&
Qnkj nx tzwx yt gj xujsy1 sty yt gj xf{ji3
j mf{j mtuj3333 Wjgjqqntsx fwj gznqy ts mtuj3333
N kfnqji r~ |f~ yt xzhhjxx3
Ex: If the input is:
WrongFileName
the output is:
File does not exist
In JAVA how do you encode and print each sentence in the file using a.pdf

In JAVA how do you encode and print each sentence in the file using a.pdf

  • 1.
    In JAVA howdo you encode and print each sentence in the file using a basic Caesar Cipher. - Encode the characters by shifting their Unicode value by 5 - For example if we encoded the character 'A' with a shift of 5 it would become the character 'F' - For example if we encoded the character 'X' with a shift of 5 it would become the character ']' - Spaces should be printed but not encoded - Use the method caesarCipher Write each encoded sentence to a new text file called encoded.txt - If a IOException is thrown catch the exception and alert the user of the error - Use the method encodedFile (The main method cannot be set to throw any exceptions. The text file will contain multiple lines and each line will correspond to a single sentence.) Sample Output: Ex: If input is: anexample.txt the output is: Please enter the name of the file: It tw it sty1 ymjwj nx st yw~& Qnkj nx f qtsl qjxxts ns mzrnqny~3 Ex: If input is: anexample2.txt the output is: Please enter the name of the file: Mjqqt Qnq~1 ~tz itnsl |jqqD N,r knsj&&&&& Qnkj nx tzwx yt gj xujsy1 sty yt gj xf{ji3 j mf{j mtuj3333 Wjgjqqntsx fwj gznqy ts mtuj3333 N kfnqji r~ |f~ yt xzhhjxx3 Ex: If the input is: WrongFileName the output is: File does not exist