subject

For this assignment you will be implementing simple rotation encryption to be used on a text file. Your program will need to read in text from a text file and encrypt or decrypt it (have the user select which) using the encryption key entered by the user, then write the results out to another file. The user will enter the names of the source and destination files, the encryption key, and will select whether they are encrypting or decrypting the file.
Rotation Encryption:
Rotation encryption involves shifting each letter in the encrypted passage forward by the amount of the encryption key. For example, if the string to encrypt is "Apple" and the encryption key is 2, the encrypted result is "Crrng". Decryption reverses the process by shifting each letter backward by the amount of the encryption key, so "Crrng" decrypts back to "Apple". Note that if someone were to have a copy of an encrypted file and your program, they could recover the original contents only if they also knew the encryption key (while this encryption could easily be "brute-forced," i. e. all possible encryption keys could be tried, real world encryption methods have many more possible encryption keys and decryption is a longer process, making this impractical).
Some notes for our implementation:
We will only be encrypting alphabetical characters, i. e. AZ and a-z. Any nonalphabetical characters should be skipped over and kept as-is by the encryption and decryption functions.
We will maintain case when encrypted, i. e. lowercase letters will remain lowercase and uppercase letters will remain uppercase.
If a character would encrypt or decrypt past the ends of AZ or a-z (i. e. beyond Z/z when encrypting or before A/a when decrypting) we will wrap it around to the other end (i. e. with encryption key 3, Y encrypts to B and decrypts back to Y, and y encrypts to b and decrypts back to y).
Your program should be split into functions. At a minimum, the following four functions must be implemented, though you may use others if desired:
A function that reads from a file (takes a single string parameter for the filename and returns a string).
A function that writes to a file (takes 2 string parameters, one for the filename and one for the contents to be written, return type of void).
A function that performs encryption (takes a string parameter for the string to be encrypted and an int parameter for the encryption key, returns the encrypted result as a string).
A function that performs decryption (takes a string parameter for the string to be encrypted and an int parameter for the encryption key, returns the decrypted result as a string).
Hint: Encryption and decryption are very similar – you might want to have your encryption function call your decryption function or vice versa, or write a third function that encryption and decryption both call in order to avoid repetition.
Note: Main should handle all user input. The encrypted or decrypted result is written to a file. Acceptable encryption keys are in the range 1-25 inclusive, you must validate the user’s entered encryption key and if it is out of range require that they re-enter it.
Submit the following to Cougar Courses:
Your code (all .cpp or .C file(s), and any .h files if applicable)
Screenshot(s) of your program having been compiled and then running on empress, including the compilation line (g++ …)
Contents of a sample file, before encryption, after encryption, and after decryption. (note: before and after should match if your program works properly). Save these as 3 text files, "original. txt", "encrypted. txt" and "decrypted. txt".

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
Today is the anniversary of me being on yet, i don't need it anymore! here's a picture of my dog wearing a bowtie! my question is, how do i delete my account?
Answers: 1
question
Computers and Technology, 23.06.2019 05:30
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which best compares appointments and events in outlook 2010appointments have a subject man, and events do notappointments have a specific date or range of dates, and events do notappointments have a start and end time of day, and events do notappointments have a location option, and events do not
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
You know the right answer?
For this assignment you will be implementing simple rotation encryption to be used on a text file. Y...
Questions
question
Mathematics, 07.01.2021 19:10