Question: ******I ONLY NEED ENCODE NOT DECODE*********** In this homework assignment, you are golng to write 2 programs to encode and decode messages using codes such

 ******I ONLY NEED ENCODE NOT DECODE*********** In this homework assignment, youare golng to write 2 programs to encode and decode messages usingcodes such as Morse code. NOT You will he writing two programs.

******I ONLY NEED ENCODE NOT DECODE***********

In this homework assignment, you are golng to write 2 programs to encode and decode messages using codes such as Morse code. NOT You will he writing two programs. Both programs will use the class Code. One program will use the class to encode a messaqe. The second wll use the code to decode the message. The Morse code table 1s glven below: International Morse Code A dashis equalto thzee dots 2 The space between parts of the same letter is equal to one dot. 3 The space between two letters is equal te three dots 4 "paca b ween two weeds isojualto seven does Our software wtll 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 tratling space indtcates 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 prugram should include the lowing class: public Code Detault constructor laads and uses merse code Code vectorint codewords) constructor loading custonizcd code string encodelvectorcchars nessage encodes anessage consisting of A-z tring decodelvectorsstringa nessag: decodes a nessage private: vector morsecode () // This function returns a vector containing the morse code vector temp (28); temp [0] =" temp [1] "- . . . "; temp [2] ="-...". temp [3] -"-.."; temp [4] ="." temp[5]-". .-." temp [6] ="--.". temp [7] =" "; temp [8] -" ."; temp [9] =" ". temp[10] temp[11] -".-..'" temp [ 12 ] ="--" temp [ 13 ] ="-.... temp [ 14 ] =" " temp[15] -". -- . temp [16] -"-- . -." temp [17] =" temp [ 18 ] .. temp [ 19 ] ="-" : temp [20] -".. - "; temp[21] ". temp [22] ". -- "; temp [23] -"- . . - "; temp [24] -"- . --"; temp [25] "-- . ."; temp [27] ="x". return temp; ALPHACODE vector alphacode() // This returns a vector containing the alphabet a-z and"" vector temp; temp.push_back (c) temp.push_back(' ); temp, pushback('') ; return temp; - In this homework assignment, you are golng to write 2 programs to encode and decode messages using codes such as Morse code. NOT You will he writing two programs. Both programs will use the class Code. One program will use the class to encode a messaqe. The second wll use the code to decode the message. The Morse code table 1s glven below: International Morse Code A dashis equalto thzee dots 2 The space between parts of the same letter is equal to one dot. 3 The space between two letters is equal te three dots 4 "paca b ween two weeds isojualto seven does Our software wtll 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 tratling space indtcates 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 prugram should include the lowing class: public Code Detault constructor laads and uses merse code Code vectorint codewords) constructor loading custonizcd code string encodelvectorcchars nessage encodes anessage consisting of A-z tring decodelvectorsstringa nessag: decodes a nessage private: vector morsecode () // This function returns a vector containing the morse code vector temp (28); temp [0] =" temp [1] "- . . . "; temp [2] ="-...". temp [3] -"-.."; temp [4] ="." temp[5]-". .-." temp [6] ="--.". temp [7] =" "; temp [8] -" ."; temp [9] =" ". temp[10] temp[11] -".-..'" temp [ 12 ] ="--" temp [ 13 ] ="-.... temp [ 14 ] =" " temp[15] -". -- . temp [16] -"-- . -." temp [17] =" temp [ 18 ] .. temp [ 19 ] ="-" : temp [20] -".. - "; temp[21] ". temp [22] ". -- "; temp [23] -"- . . - "; temp [24] -"- . --"; temp [25] "-- . ."; temp [27] ="x". return temp; ALPHACODE vector alphacode() // This returns a vector containing the alphabet a-z and"" vector temp; temp.push_back (c) temp.push_back(' ); temp, pushback('') ; return temp

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!