Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can you please verify its correct when you finish because I\'ve posted this mult

ID: 3789540 • Letter: C

Question

Can you please verify its correct when you finish because I've posted this multiple times but I've been getting wrong answers from other people who try it. This is one question. (PLEASE USE C++ CODE) Thank You

In this assignment, you are going to write a program to encode messages using codes such as Morse code. This programs will use the class Code. The program will use the class to encode a 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.

};

The encode will input an alphabetic message from a file, and use the class to build the morse code string, and then output the string. You can download the functions morsecode and alphacode.

International Morse Code 1. A dash is equal to three dots 2. The space between parts of the same letter is equal to one dot. 3. The space between two letters is equal to three dots 4. The space between two words is equal to seven dots.

Explanation / Answer

//main.cpp

====================================================================

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote