Question: * NO HAND WRITING PLEASE * In this homework assignment, you are going to write 2 programs to encode and decode messages using codes such

* NO HAND WRITING PLEASE *

In this homework assignment, you are going to write 2 programs to encode and decode messages using codes such as Morse code. NOTE : You will be writing two programs. Both programs will use the class Code. One program will use the class to encode a message. The second will use the code to decode the message. The Morse code table is given below :

Our software will support codes that consist of symbols followed by a blank space. For example, in a message if an A appears, it will be replace by ".- ". The trailing space indicates the end of the codeword for that character. (NOTE: We will only be using the characters A-Z. Morse code words are separated by a space, so the message "cat" would be -.-. .- - x where x indicates the end of message. Note that spaces between words are denoted by 7 dots ".......". You can assume that encoded messages end with a lowercase x (which means STOP). When converting a message from text to code, a period "." should be converted to an x.)

Requirements

Your program should include the following class :

class Code { public: Code(); // Default constructor - loads and uses morse code Code(vector codewords); // constructor loading customized code string encode(vector message); // encodes a message consisting of A-Z string decode(vector message); // decodes a message private: vector codewords; // this is a codeword vector parallel to A-Z vector alpha; // this is the vector A-Z vector alphacode(); // function builds the vector alpha - A B C etc. vector morsecode(); // function the vector codewords containing morse code string encode(char x); //returns the codeword for the character x char decode(string c); //returns the character for the codeword c. }; 

You will need to submit your programs that test both encode and decode.. The first (encode) will input an alphabetic message from a file, and use the class to build the morse code string, and then output the string. The second (decode) will input a morse code string from a file and use the classto build the decoded string, and then output the string. You can download the functions morsecode and alphacode.

Be sure you understand the software specifications before you begin your work!

* NO HAND WRITING PLEASE * In this homework assignment, you are* NO HAND WRITING PLEASE * In this homework* NO HAND WRITING PLEASE * In this homework* NO HAND WRITING PLEASE * In this homework

International Morse Code 1. 2. A dash is equal to three dots. The space between parts of the same letter is equal to one dot. IR

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!