Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE INCLUDE ALL OF THE INFORMATION LISTED BELOW: Develop a Java application that uses a type of encrypted alphabet, called a random monoalphabetic cipher, to

PLEASE INCLUDE ALL OF THE INFORMATION LISTED BELOW:

Develop a Java application that uses a type of encrypted alphabet, called a random monoalphabetic cipher, to encrypt and decrypt a message. Your encryption key and message are to be read in from two different files and then the encrypted message will be output to third file. Then the encrypted message is read in and decrypted to a fourth file.

How this encryption algorithm works is described fully below. You dont need to research encryption algorithms beyond the following description.

A monoalphabetic cipher starts with an encryption word, removes the redundant letters from the word, and assigns whats left to create an encrypted alphabet such that the first encrypted alphabet letter corresponds to A, the next to B, etc. Then the unused letters in the encryption word are then assigned to correspond to alphabetic letters starting with Z.

For example, if the encryption word is FEATHER, the non-redundant letters are F, E, A, T, H, and R. These are assigned to A through F like this:

Original alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ

Encrypted alphabet:FEATHR

The letters of the alphabet not in the set of F, E, A, T, H, and R are then assigned to the other letters of the alphabet starting with Z and working back towards A to form a full alphabetic cipher like this:

Original alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ

Encrypted alphabet:FEATHRZYXWVUSQPONMLKJIGDCB

For this program you must use the encryption word TROYONLINE to encrypt your text.

This program uses 4 total files. Use file keyword.txt to hold your encryption key word, file input.txt as your input plain text file, encrypt.txt as your encrypted output file, and file output.txt as your decrypted output file. Use Notepad to create the keyword.txt and input.txt files.

First create your encrypted alphabetic and then encrypt the following sentence:

THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG

Just encrypt and decrypt upper case letters to other upper case letters. Dont worry about lower case letters and encrypting the spaces.

A sample of the four input and output files and example program output using the encryption word FEATHER is shown below. Using this keyword to test your program is a good idea as you should get the same outputs as shown in this example.

Heres an example of the output from this example program with debugging statements added.

M ----jGRASP exec: java EncryptorTester MMMRaw key input: FEATHER MMMUnique character key used: FEATHR MMMAlphabet and encrypted characters: MMMABCDEFGHIJKLMNOPQRSTUVWXYZ MMMFEATHRZYXWVUSQPONMLKJIGDCB MMMPlaintext byte 84 (T) encoded as K MMMPlaintext byte 72 (H) encoded as Y MMMPlaintext byte 69 (E) encoded as H MMMPlaintext byte 32 ( ) was not encoded MMMPlaintext byte 81 (Q) encoded as N MMMPlaintext byte 85 (U) encoded as J MMMPlaintext byte 73 (I) encoded as X MMMPlaintext byte 67 (C) encoded as A MMMPlaintext byte 75 (K) encoded as V MMMPlaintext byte 32 ( ) was not encoded MMMPlaintext byte 66 (B) encoded as E MMMPlaintext byte 82 (R) encoded as M MMMPlaintext byte 79 (O) encoded as P MMMPlaintext byte 87 (W) encoded as G MMMPlaintext byte 78 (N) encoded as Q MMMPlaintext byte 32 ( ) was not encoded MMMPlaintext byte 70 (F) encoded as R MMMPlaintext byte 79 (O) encoded as P MMMPlaintext byte 88 (X) encoded as D MMMPlaintext byte 32 ( ) was not encoded MMMPlaintext byte 74 (J) encoded as W MMMPlaintext byte 85 (U) encoded as J MMMPlaintext byte 77 (M) encoded as S MMMPlaintext byte 80 (P) encoded as O MMMPlaintext byte 69 (E) encoded as H MMMPlaintext byte 68 (D) encoded as T MMMPlaintext byte 32 ( ) was not encoded MMMPlaintext byte 79 (O) encoded as P MMMPlaintext byte 86 (V) encoded as I MMMPlaintext byte 69 (E) encoded as H MMMPlaintext byte 82 (R) encoded as M MMMPlaintext byte 32 ( ) was not encoded MMMPlaintext byte 84 (T) encoded as K MMMPlaintext byte 72 (H) encoded as Y MMMPlaintext byte 69 (E) encoded as H MMMPlaintext byte 32 ( ) was not encoded MMMPlaintext byte 76 (L) encoded as U MMMPlaintext byte 65 (A) encoded as F MMMPlaintext byte 90 (Z) encoded as B MMMPlaintext byte 89 (Y) encoded as C MMMPlaintext byte 32 ( ) was not encoded MMMPlaintext byte 68 (D) encoded as T MMMPlaintext byte 79 (O) encoded as P MMMPlaintext byte 71 (G) encoded as Z MMMCyphertext byte 75 (K) decoded as T MMMCyphertext byte 89 (Y) decoded as H MMMCyphertext byte 72 (H) decoded as E MMMCyphertext byte 32 ( ) was not decoded MMMCyphertext byte 78 (N) decoded as Q MMMCyphertext byte 74 (J) decoded as U MMMCyphertext byte 88 (X) decoded as I MMMCyphertext byte 65 (A) decoded as C MMMCyphertext byte 86 (V) decoded as K MMMCyphertext byte 32 ( ) was not decoded MMMCyphertext byte 69 (E) decoded as B MMMCyphertext byte 77 (M) decoded as R MMMCyphertext byte 80 (P) decoded as O MMMCyphertext byte 71 (G) decoded as W MMMCyphertext byte 81 (Q) decoded as N MMMCyphertext byte 32 ( ) was not decoded MMMCyphertext byte 82 (R) decoded as F MMMCyphertext byte 80 (P) decoded as O MMMCyphertext byte 68 (D) decoded as X MMMCyphertext byte 32 ( ) was not decoded MMMCyphertext byte 87 (W) decoded as J MMMCyphertext byte 74 (J) decoded as U MMMCyphertext byte 83 (S) decoded as M MMMCyphertext byte 79 (O) decoded as P MMMCyphertext byte 72 (H) decoded as E MMMCyphertext byte 84 (T) decoded as D MMMCyphertext byte 32 ( ) was not decoded MMMCyphertext byte 80 (P) decoded as O MMMCyphertext byte 73 (I) decoded as V MMMCyphertext byte 72 (H) decoded as E MMMCyphertext byte 77 (M) decoded as R MMMCyphertext byte 32 ( ) was not decoded MMMCyphertext byte 75 (K) decoded as T MMMCyphertext byte 89 (Y) decoded as H MMMCyphertext byte 72 (H) decoded as E MMMCyphertext byte 32 ( ) was not decoded MMMCyphertext byte 85 (U) decoded as L MMMCyphertext byte 70 (F) decoded as A MMMCyphertext byte 66 (B) decoded as Z MMMCyphertext byte 67 (C) decoded as Y MMMCyphertext byte 32 ( ) was not decoded MMMCyphertext byte 84 (T) decoded as D MMMCyphertext byte 80 (P) decoded as O MMMCyphertext byte 90 (Z) decoded as G MMM MMM ----jGRASP: operation complete.

This program used class Encryptor to perform the encryption and decryption and class EntryptorTester to handle all the file input and output and pass and receive text from the Encryptor class.

This program was taken from Programming Exercise P19.1 on page 796 of Chapter 19 of Cay Horstmanns Big Java (4th Edition). This reference is only included to cite the source of the program. You do not need to obtain this book!

You are to submit the following deliverables to the Assignment Dropbox in a single Microsoft Word or PDF file, in this order:

A screen snapshot of your Java source code (just the beginning is OK) as it appears in your IDE (e.g. jGRASP, Net Beans, Eclipse, etc.).

A listing of your entire Java source code in the same Microsoft Word file as item a), and following item a). You can simply copy and paste the text from your IDE into Word. Be sure to maintain proper code alignment by using Courier font for this item.

A screen snapshot of your programs inputs and outputs in the same Microsoft Word file, and following item b). Be sure to include any program inputs and outputs you have when your program executes. Also, you must include screen snapshots of the 4 files showing their names and contents.

Your instructor may compile and run your program to verify that it compiles and executes properly.

You will be evaluated on (in order of importance):

Inclusion of all deliverables in Step #2 in the correct order.

Correct execution of your program. This includes getting the correct results.

Adequate commenting of your code.

Good programming style (as specified in the textbook's examples).

Neatness in packaging and labeling of your deliverables.

Deficiencies in any of the above areas will result in lost points based on the severity of the deficiency.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago