Starting from:

$35

COP 4045  Assignment #3 Caesar cypher

COP 4045 
Assignment #3
Assignment Overview
In this assignment you will create a simpler, modified version of your solution for A2 (encryption and
decryption of plain-text messages), in which you are expected to demonstrate your understanding of
functions and (text) file operations in Python.
Project Specification
In this assignment you will implement the Caesar cypher, with the following twists and simplifications
(relative to A2):
• You only need to encrypt (uppercase and lowercase) letters. All other characters from the plain text
should bypass the encryption algorithm and be written unchanged onto the cyphertext (and
eventually saved to the output file).
• The key will be fixed (i.e., hardcoded) and equal to 3.
• You must have two functions (one called encrypt and another called decrypt), with the proper choice
of parameters (e.g., input string (word) and key).
o These functions must operate at a word level.
o Reading from (and writing to) files, traversing file contents and breaking the text down into
individual strings (which are then passed as parameters to the encrypt and decrypt functions),
and handling other tasks (reading input from user, printing messages on the screen, etc.)
should be done outside of the two functions above.
o You are encouraged, of course, to write meaningful additional functions for certain tasks that
might appear again later in your life as a Python programmer.
Your program will:
1. Print a brief (2-5 lines) message explaining the purpose of this “app”.
2. Prompt for:
§ The input filename (from which the plaintext or cyphertext will be read)
§ The choice of operation (E/D, for encrypt/decrypt).
3. Process the file contents according to the encryption/decryption algorithm.
4. Save the result of the encryption/decryption algorithm into a text file, whose name should be the
same as the input file + a standard suffix (_enc for encrypted and _dec for decrypted).
§ For example, if the input file is mammamia.txt and the choice of operation is E, the output
file should be called mammamia_enc.txt. If the input file is mariotime.txt and the
choice of operation is D, the output file should be called mariotime_dec.txt.
5. Print a meaningful message (success or failure, name of output file) and ask if the user wants to
submit another file or quit.
Deliverables
You must submit (via Canvas):
- The file a3_FAUusername.py (where “FAUusername” is your FAU username; in my case the file
would be called a3_omarques.py)
o This is your source code solution; be sure to include your name, date, assignment number and
comments describing your code.
- A README.md file with “project notes” (describing what my TA and I cannot see by looking at your
source code and/or running your program).
o Examples: design decisions, documented limitations, future improvements, etc.
- A screenshot of the results produced by your code (make sure to show input and output for at least
one run).
Notes and Hints: • Follow the “cardinal rules” of programming in Python (as per the textbook).
• Start by breaking the program down into parts and solve smaller problems before producing the final
solution.
• Try to handle special cases and prevent runtime errors to the best of your knowledge.
• Don’t overdo it!
Bonus opportunities:
This is an odd-numbered assignment.
There are no bonus opportunities (unless, of course, you guess my zoom background in lectures 5 or 6). J

More products