Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment #2 Problem Solving and Programming in C++ Department of Computer Science Old Dominion University Objectives: This assignment will give you an opportunity to explore

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Assignment #2 Problem Solving and Programming in C++ Department of Computer Science Old Dominion University Objectives: This assignment will give you an opportunity to explore the process of dividing a C++ program into modules and using the project support components of a C++ IDE to manage your modules. General Instructions: Read the problem description below and implement this program in C++. The files for this assignment are provided under the folder for this assignment. You will be submitting two separate projects. See Part A and Part B for details. o . o All of the functions making up this program are complete and in working order except for those marked with ///FILL THIS FUNCTION comments, which you must implement. The major challenge in this assignment is to divide the program into separately compiled modules. An Encoder module, consisting of files 'encoder.h' and 'encoder.cpp', containing code dealing specifically with encoding a message. A decoder module, consisting of files 'decoder.h' and 'decoder.cpp', containing code dealing specifically with decoding a message. There are some functions that are not specifically related to either of these modules, but that contain code needed by them. You should apportion these functions to the modules in a way consistent with the goals of high cohesion and low coupling. Consult the comments in the provided code for additional details. First step will be to change input from std::cin to taking input from a file called "message.txt or "encoded.txt". The given code has two Global Variables. Your finished code should have no Global Variables. o Problem description: You have a friend who enjoys sending you messages that have been encrypted using a Rail Fence Cipher. While you could easily work them out by hand, sometimes the message is long, and after 15 minutes of work all you have is several rambling sentences about what they did or didn't do over the weekend. To save yourself some time, you decide to create a program to quickly decipher their messages, and even encode your responses. The assignment will be to create a C++ program that, given .txt file containing a coded message, will decode the message when given a key between 2 and 5. The program will also be able to encode a message given in a text file, using a corresponding key between 2 and 5. A Rail Fence Cipher is a type of transposition cipher. When given a message "I had the craziest dream last night" and a key representing the number of rails, the letters of the message are transposed onto the rails in a zig-zag pattern. Lets assume a key of '3': I ... T... R ...E...R... L ...N ... T .H.D.H.C.A.I.S.D.E.M.A.T.I.H. A ... E... Z ...T... A ...S...G.. As you can see, the message goes down and up the rails, excluding spaces. Once the message is on the rails, it is read off row by row to get the following encoded message. ITRERLNTHDHCAISDEMATIHATEZTASG For the purposes of this assignment, you will have to remove the spaces and punctuation from the message before encoding it. The resulting encoded and decoded messages will be without spaces or punctuation, but that won't prevent the decoded message from being readable. Encoding with a key of 3: *****Welcome to Rail Fence Coder***** Menu: 1 - encrypt a file 2 decrypt a file 3 quit Selection: 1 Select a key (2-5): 3 I had the craziest dream last night ITRERLNTH DHCA ISDEMATIHAEZTASG Decoding a message that had been encoded with a key of 3: *****Welcome to Rail Fence Coder***** Menu: : 1 - encrypt a file 2 decrypt a file 3 quit Selection : 2 Select a Key (2-5): 3 ITRERLNTHDHCAISDEMATIHAEZTASG IHADTHECRAZIESTDREAMLASTNIGHT Encoding with a kovofl Encoding with a key of 4: *****Welcome to Rail Fence Coder***** Menu: 1 - encrypt a file 2 decrypt a file 3 quit Selection: 1 Select a Key (2-5): 4 I had the craziest dream last night I EEANHHCISEMTIATRZTRLSGT DADAH Input Input to the program is taken from the standard input (cin). You will need to change this to make your program read a single line of input from the text file message.txt or encoded.txt" as appropriate. Example files are included. The encoded message in encoded.txt was encoded with a key of 3. You should also test your decoder on messages encoded with other keys. Output The program is set to print the result to screen. In addition to printing to the screen, your program should also print to a file "result.txt". Part A: Create a project containing the file 'railFence.cpp'. Implement the empty functions marked with ///Fill This Function comments, remove Global Variables, and ensure correct input and output. The program should compile and have expected Input and Output as outlined above. You will not need to split the functions into Modules for this portion. Part B: Create a project containing the files 'railFence.cpp', 'decoder.cpp', 'decoder.h', 'encoder.cpp', and 'encoder.h'. Split the functions from Part A into the appropriate modules as outlined in the general instructions. The program should compile and have the same input and output as Part A. Submission notes: . Submit all files from your project folder, including the .cpp, .cbp, .h, and input files. For Part A, you should zip the entire folder and name it as Assg2_PartA_cslogin.zip", where the cslogin is your login ID for the computers at the Department of Computer Science at ODU. For Part B, you should zip the entire folder and name it as Assg2_PartB_cslogin.zip, where the cslogin is your login ID for the computers at the Department of Computer Science at ODU. Submit the zipped file in the respective Blackboard link. . Assignment #2 Problem Solving and Programming in C++ Department of Computer Science Old Dominion University Objectives: This assignment will give you an opportunity to explore the process of dividing a C++ program into modules and using the project support components of a C++ IDE to manage your modules. General Instructions: Read the problem description below and implement this program in C++. The files for this assignment are provided under the folder for this assignment. You will be submitting two separate projects. See Part A and Part B for details. o . o All of the functions making up this program are complete and in working order except for those marked with ///FILL THIS FUNCTION comments, which you must implement. The major challenge in this assignment is to divide the program into separately compiled modules. An Encoder module, consisting of files 'encoder.h' and 'encoder.cpp', containing code dealing specifically with encoding a message. A decoder module, consisting of files 'decoder.h' and 'decoder.cpp', containing code dealing specifically with decoding a message. There are some functions that are not specifically related to either of these modules, but that contain code needed by them. You should apportion these functions to the modules in a way consistent with the goals of high cohesion and low coupling. Consult the comments in the provided code for additional details. First step will be to change input from std::cin to taking input from a file called "message.txt or "encoded.txt". The given code has two Global Variables. Your finished code should have no Global Variables. o Problem description: You have a friend who enjoys sending you messages that have been encrypted using a Rail Fence Cipher. While you could easily work them out by hand, sometimes the message is long, and after 15 minutes of work all you have is several rambling sentences about what they did or didn't do over the weekend. To save yourself some time, you decide to create a program to quickly decipher their messages, and even encode your responses. The assignment will be to create a C++ program that, given .txt file containing a coded message, will decode the message when given a key between 2 and 5. The program will also be able to encode a message given in a text file, using a corresponding key between 2 and 5. A Rail Fence Cipher is a type of transposition cipher. When given a message "I had the craziest dream last night" and a key representing the number of rails, the letters of the message are transposed onto the rails in a zig-zag pattern. Lets assume a key of '3': I ... T... R ...E...R... L ...N ... T .H.D.H.C.A.I.S.D.E.M.A.T.I.H. A ... E... Z ...T... A ...S...G.. As you can see, the message goes down and up the rails, excluding spaces. Once the message is on the rails, it is read off row by row to get the following encoded message. ITRERLNTHDHCAISDEMATIHATEZTASG For the purposes of this assignment, you will have to remove the spaces and punctuation from the message before encoding it. The resulting encoded and decoded messages will be without spaces or punctuation, but that won't prevent the decoded message from being readable. Encoding with a key of 3: *****Welcome to Rail Fence Coder***** Menu: 1 - encrypt a file 2 decrypt a file 3 quit Selection: 1 Select a key (2-5): 3 I had the craziest dream last night ITRERLNTH DHCA ISDEMATIHAEZTASG Decoding a message that had been encoded with a key of 3: *****Welcome to Rail Fence Coder***** Menu: : 1 - encrypt a file 2 decrypt a file 3 quit Selection : 2 Select a Key (2-5): 3 ITRERLNTHDHCAISDEMATIHAEZTASG IHADTHECRAZIESTDREAMLASTNIGHT Encoding with a kovofl Encoding with a key of 4: *****Welcome to Rail Fence Coder***** Menu: 1 - encrypt a file 2 decrypt a file 3 quit Selection: 1 Select a Key (2-5): 4 I had the craziest dream last night I EEANHHCISEMTIATRZTRLSGT DADAH Input Input to the program is taken from the standard input (cin). You will need to change this to make your program read a single line of input from the text file message.txt or encoded.txt" as appropriate. Example files are included. The encoded message in encoded.txt was encoded with a key of 3. You should also test your decoder on messages encoded with other keys. Output The program is set to print the result to screen. In addition to printing to the screen, your program should also print to a file "result.txt". Part A: Create a project containing the file 'railFence.cpp'. Implement the empty functions marked with ///Fill This Function comments, remove Global Variables, and ensure correct input and output. The program should compile and have expected Input and Output as outlined above. You will not need to split the functions into Modules for this portion. Part B: Create a project containing the files 'railFence.cpp', 'decoder.cpp', 'decoder.h', 'encoder.cpp', and 'encoder.h'. Split the functions from Part A into the appropriate modules as outlined in the general instructions. The program should compile and have the same input and output as Part A. Submission notes: . Submit all files from your project folder, including the .cpp, .cbp, .h, and input files. For Part A, you should zip the entire folder and name it as Assg2_PartA_cslogin.zip", where the cslogin is your login ID for the computers at the Department of Computer Science at ODU. For Part B, you should zip the entire folder and name it as Assg2_PartB_cslogin.zip, where the cslogin is your login ID for the computers at the Department of Computer Science at ODU. Submit the zipped file in the respective Blackboard link

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe the Hawthorne experiments, and critically analyze them?

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago