For this lab, you are given a file that is already encrypted using the substitution cipher and a file containing the key used to encrypt the content. Write a program to read the encrypted file, to decrypt one line at a time, and write each decrypted line into another file. Allow the user to specify the input filename and output filename. Use exception handling to check for file existence on the input file and to determine if the output file exists so you can ask the user if the output file should be overwritten or not. Prompt for another output filename if the user does not want the file overwritten or if the output filename is the same as the input filename.
The encrypted file contains capital letters and punctuation characters. To simplify the decryption process, only decrypt letters and leave punctuation and other characters alone. Leave uppercase letters as uppercase and lowercase letters as lowercase; for example, ‘a’=’t’ and ‘A’=’ T’. Also, “(“is encrypted or decrypted as “(“, and “.” as “.”)
Get Free Quote!
387 Experts Online