Question: Write a program that decodes a secret messages read from a text file using an alphabetic shift. So, for example, a shift might appear as:

Write a program that decodes a secret messages read from a text file using an "alphabetic shift." So, for example, a shift might appear as:

COMPUTER with a shift of 2 would be EQORWVGT.

ORIGINAL: ABCDE...XYZ

SHIFTED: CDEFG...ZAB

You must utilize stopwise refinement to break this program into appropriate and less-complicated components, say:

1.) Read the encoded message from the attached MessageIn.txt file,

2.) Count the instances of each character in the file,

3.) The most common character in the message should be an "E". Use this information to calculate the amount of the shift,

4.) Print out the decoded message.

I have included Program.cs as an attachment which demonstrates one way a character can be assigned an index value into an array.

Read Message From File 10 points

Count Occurrences of Letters 20 points

Find Maximum Occurrence 10 points

Calculate Shift 10 points

Apply Shift to Encoded Message 20 points

Output 10 points

Works for Any Shift Value 10 points

Comments That Explain Coding 10 points

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!