Question: You will be writing a program to perform a simple encryption and decryption of a file using the Queue that you just built. Download and
You will be writing a program to perform a simple encryption and decryption of a file using the Queue that you just built. Download and extract "EncryptionAssignment.zip" from under Session under Modules. You can use the logic in "Codes.java" as a starting point for your program. In order to use Codes.java, you must have the java files necessary to run your Queue in the same folder.
Take some time to look at "textToEncode.txt; you will be encoding the contents of this file using the keys from "key.txt In order to keep things simple, I have included only uppercase characters in the textToEncode.txt file. You are free to change the contents of textToEncode.txt and key.txt but please make sure that the text in textToEncode.txt is all uppercase and the values in key.txt are between and
This assignment will build on the concept of repeating key from the slides. The first line from key.txt will be used to encodedecode the first line from textToEncode.txttextToDecodetxt The second line from key.txt will be used to encodedecode the second line from textToEncode.txttextToDecodetxt and so on Once you have use the final line from key.txt you will go back to using the first line.
Create a new Java file "SuperCodes.java" and do the following in it:
Write a method to encode the text in file "textToEncode.txt making use of the Queue that your have just created and output the encoded text to the screen.
Create another method to decode the text in "textToDecode.txt in a similar manner.
Create a main method that will use the two methods from # and #
Testing: If you have edited "key.txt "textToEncode.txt or "textToDecode.txt change the file contents back to the original form to check the output below.
Once your method encodes the text in "textToEncode.txt it should output the following:
MQOTX$RTc#IIXMSSSS#XHKK
K#GTPQLTNRKQK
JEZ&LYISOTJ&TPC
KP$KX#UOI"HBLGW#JU$CQDTRE"YREHA
KY$KX$XJVGJNPN#
ITXVSIM#Q$XNOHJRNcDZV$MUVMWJRNXRJMJV
ZZK#NLL#
DBHE
Once your method decodes the text in "textToDecode.txt it should output the following:
BLOW, BLOW, THOU WINTER WIND
THOU ART NOT SO UNKIND
AS MAN'S INGRATITUDE;
THY TOOTH IS NOT SO KEEN,
BECAUSE THOU ART NOT SEEN,
ALTHOUGH THY BREATH BE RUDE.
HEIGHHO SING, HEIGHHO UNTO THE GREEN HOLLY:
MOST FREINDSHIP IF FEIGNING, MOST LOVING MERE FOLLY:
THEN HEIGHHO THE HOLLY!
THIS LIFE IS MOST JOLLY.
textToEncode.txt
HELLO HOW ARE YOU DOING TODAY?
I AM DOING FINE
WHAT IS GOING ON
HOW IS THE WEATHER IN ALASKA TODAY?
IT IS VERY CHILLY!!
FLORIDA IS NICE AND WARM THIS TIME OF THE YEAR.
SO I HEAR!
YAAAAY
textToDecode.txt
GXR$LQZXRTa#RRJ#RRN
VKUMTW&UZVUZMLTK
FU$SGQXMTMUGYKXJHA
WI$VTRUO$KX#OVX"XRRIGS
DJGCZWGXJTYFVVRQY$UJIP
FXWPXYQMWPb$LWQDQ$LJUMI
MGMMNNT#$YOQM"LKOJNJS&XTYQ$ZNHIKT#NTNP@
NVWVISLMPIVIPT"NIMIKLQJUK.PPZXQRWPRIPFYI"KRMS
XJJRMIKLLMSXJJ$JTPN
YTLPSKQ#Q$WTWSSVQe
key.txt
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
