Create a program that begins by prompting the user

Assignment Help Computer Engineering
Reference no: EM132171843

Using Python, create a program that begins by prompting the user for an input file (which contains the message), 5 shift amounts (all integers), and whether they would like to encrypt or decrypt, then our implementation will add some variation to the basic algorithm to make it a little harder to decode. When encrypting:

(1) We will read the text data from the file line-by-line, and all of the transformations described below be should applied line-by-line. Before doing the transformations below you should use strip() to remove the whitespace at the ends of a line.

(2) Replace each "e" character in the original message with the letters "zw". If the file contains "Hello World!", the resulting message will be "Hzwllo World!".

(3) After replacing the "e" characters, you'll add the word "hokie" to the beginning, middle (the middle is length//2), and the end of the message. Continuing with example above the message that's actually encrypted using the Caesar Cipher is "hokieHzwllohokie World!hokie". This should be done for each line in the file.

Once you have the altered message then we will perform a slightly modified Caesar Cipher encoding as described below and print the result. Like above this transformation is applied line- by-line and shouldn't "cross" lines.

Rather than have a single shift, instead we will have 5 shift amounts entered by the user. The shifts are applied character by character. So if the user enters shift amounts: 3 4 5 6 7 and the first line of the file contains "Hello World!", your program will first transform it into "hokieHzwllohokie World!hokie" then:

"h" would be shifted by 3 characters. "o" would be shifted by 4 characters. "k" would be shifted by 5 characters. "i" would be shifted by 6 characters. "e" would be shift by 7 characters.

We then start back at the first shift amount:

"H" would be shifted by 3 characters. "z" would be shifted by 4 characters. "w" would be shifted by 5 characters. "l" would be shifted by 6 characters. "l" would be shift by 7 characters.

The space, exclamation point, and anything else that's not a letter isn't shifted, but it does "take up" a shift amount. So if the space character would have been shifted by 3 characters, the next character would be shifted by 4. This continues until the end of the line is reached. The whole process starts over with shift amount 3 on the next line in the file.

When decrypting, perform each step in reverse order. Decrypt the message using the Caesar Cipher above, then remove the "hokie" strings, then change any occurrence of "zw" to "e". You may assume the all occurrences of "zw" in the result are really "e" characters, and further you may assume the "hokie" strings are in the encrypted message at the appropriate place, however there may be other occurrences of "hokie" in the original message.

Finally, your program must be able to encrypt/decrypt an arbitrary number of messages. When you've completed the encrypting/decrypting a message the user should be asked if they want to enter another message. Your program should continue until the user types "N".

Reference no: EM132171843

Questions Cloud

Write a program that plays a modified yahtzee game : You will allow a single player to play with 5 dice. For those of you who know how to play the game, you will only play the top half of the game.
Net income is reported on the income statement : Net income is reported on the Income Statement, an accounting equation that follows GAAP, generally accepted accounting principles
Create a program that analyzes a text file and produces : Any sequence of alphanumeric characters (length >= 1) with the beginning and ending non-alphanumeric character removed counts as a word.
What is the net present value of seattle corporation : Seattle Corporation identifies an investment opportunity that will yield end of year cash flows of $30,000 in both Year 1 and Year 2
Create a program that begins by prompting the user : Create a program that begins by prompting the user for an input file (which contains the message), 5 shift amounts (all integers).
What is cabbor cost of equity capital : What is Cabbor's cost of equity capital (that is, compute the required rate of return on the stock)?
Space between the minus sign and the number : Consider a Zerobond (i.e., a bond that pays no coupon payment, meaning that the coupon rate on the bond is 0%) with a par value of $1,000 that will mature
Par value bond with a coupon rate : Compute the yield to maturity of a $1,500 par value bond with a coupon rate of 7.5% (quarterly payments - that is, four times per year) that matures in 25 years
How do organizations measure risk : Identify the major business and financial risks such as interest rate risk, foreign exchange risk, credit, commodity, and operational risks

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd