Question
In JAVA how do you encode and print each sentence in the file using a basic Caesar Cipher. - Encode the characters by shifting their
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started