Question: Write a program in Java that produces a Caesar cipher of a given message string. prompt the user for an integer key to use as
Write a program in Java that produces a Caesar cipher of a given message string.
prompt the user for an integer key to use as an offset (only allow 1- 25). This time the value the user enters will be used to seed the Random generator.
use a Random object to generate a random Int key
display a message with key to be used
create a loop to prompt user for a line of input and display it in ciphered form. "Enter line to cipher. ("blank" or "null" to exit; '#' to change key)"
read the text to be ciphered from a file.
prompt the user for the file name but allow the use of a default file that is hard coded into the program. e.g. "Enter name of file to cipher (just hit ENTER to accept default file): "
verify that the file exists and re-prompt the user until they enter a valid file or accept the default file.
after printing each ciphered line to the screen, print the ciphered line to an output file defined with the input file name + " - ciphered" appended to it.
the input file should have the key that was previously prompted for as the first line (or record), and, any line starting with a "#" should allow the key to be changed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
