Details of this Paper

c++

Description

solution


Question

Cylon says what?!?!?! Part 1;Admiral Adama needs to decrypt a series of messages from his various lookout pilots. He?s hoping that one of them will let him know the position of the Cylon fleet. Because of his standing order, computers cannot be networked together, so to decrypt the message it will have to be run through 3 separate programs run on 3 different computers.;Adama feeds the encrypted file into the first computer, and it immediately spits out a new file. Looking at it he can see that it?s starting to decrypt the file.;He then feeds this new file into the second computer, and it immediately spits out a second new file. Looking at this file he can see that the file is almost readable, but still needs to go through the next stage.;Finally, Adama feeds the file to the last computer. It immediately spits out the final decrypted file and sees that one of his pilots has indeed found the Cylon fleet.;Decryption;For this project you will be writing 3 programs. Each program will contain a main and 1 function that will do the decrypting.;Decryption stage 1;You will be given the initial file to decrypt. It will be named ?messages.txt?. You will read the sentence into a string.;You will send the string to a function you write named ?reverse_sentence?;string reverse_sentence(string s);This function will reverse the string, and then return the reversed string. Do not make a new string, save it back into the original string.;You must use one of the STL algorithms.;Next you will write the string to a new file called ?stage2.txt?.;Decryption stage 2;The structure of this program is similar to stage 1, you will open the file ?stage2.txt? and read the sentence into a string.;You will send the string to a function you write named ?normalize_sentence?;string normalize_sentence(string s);This function will down case all letters of the string, and then up case only the first character of the string. It will then return the modified string.;You must use one of the STL algorithms.;Once you have normalized the string you will then write it out to a new file called ?stage3.txt?.;Decryption stage 3;The structure of this program is similar to stage 2, you will open the file ?stage3.txt? and read the sentence into a string.;You will send the string to a function called ?replace_sentence?;string replace_sentence(string s);This function will replace certain words in the string with other words. You will then return the modified string.;You must use string functions.;YOU MUST USE A SERIES OF IF-STATEMENTS. DO NOT USE A SWITCH-STATEMENT IN THIS FUNCTION!!!;Here are the words that need to be replaced. There may be multiple words that need to be replaced in a string, but the replacement word will only appear once.;1Replace ? barn ? with ? Galactica ?;2Replace ? toaster ? with ? Cylon ?;3Replace ? juice ? with ? fuel ?;4Replace ? wagon ? with ? viper ?;You must replace the entire string if you find these phrases;After you finish write out the string to a new file named ?decrypted.txt?.;Additional Things!!;?In each program you must read in the entire file into the string before you can start using your decryption function.;?You must close the files your reading from and writing to before the end of each program.;?You can use cin/cout for testing, but remove or comment out the lines before turning in the program.;IMPORTANT HINTS!!!!;You can find the functions required in the standard template library. You can see the library on http://www.cplusplus.com under the reference section.;Do some experimentation. Write small test programs to test out functions before you build the full programs.;A messages.txt file is provided;Objectives;?practice declaring C++ variables with appropriate names and data types;?practice console I/O;?practice using C++ arithmetic operators;?practice using boolean expressions in flow-of-control statements;?learn and practice the strategy of incremental development;Requirements;?your program source code must be documented correctly (see the starter.cpp example);?your program source code must be neatly and consistently formatted (see the starter.cpp example);?your programs must compile and run without errors;?your programs must successfully read from and write to text files;? reverse_sentence function implemented correctly;? normalize_sentence function implemented correctly;? replace_sentence function implemented correctly;NOTE: Start small and get it working before you move on to a new feature. You have to follow the requirements to get credit

 

Paper#65623 | Written in 18-Jul-2015

Price : $32
SiteLock