Translating dots and dashes.
Morse code is a method used in telecommunication to encode text characters as sequences of two different signal durations, called dots and dashes, or dits and dahs. In the 1890s, Morse code began to be used extensively for early radio communication before it was possible to transmit voice. In the late 19th and early 20th centuries, most high-speed international communication used Morse code on telegraph lines, undersea cables, and radio circuits. Today, Morse code has been replaced by the Global Maritime Distress and Safety System (GMDSS). This program translates Morse code in a file into plain text.
⭐⭐⭐
Write a program that reads a file containing Morse code with dots represented with a full stop: “.”, dashes represented with hyphens: “-“ and words separated with a space and forward slash: “ / “. The program should output the contents of the file in English.
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
read_morse that:translate for each character.read_morse function is called.For a file containing:
••• •- — ••- • •-•• / — — •-• ••• • / •– •- ••• / •- -• / •- — • •-• •• -•-• •- -• / •–• •- •• -• – • •-• / •- -• -•• / •• -• •••- • -• – — •-• / •– •••• — / •• ••• / -••• • ••• – / •-• • — • — -••• • •-• • -•• / – — -•• •- -•– / ••-• — •-• / •••• •• ••• / •• -• •••- • -• – •• — -• / — ••-• / – •••• • / ••• •• -• –• •-•• • / •– •• •-• • / – • •-•• • –• •-• •- •–• •••• / ••• -•– ••• – • — / •- -• -•• / — — •-• ••• • / -•-• — -•• •
The output would be:
SAMUEL MORSE WAS AN AMERICAN PAINTER AND INVENTOR WHO IS BEST REMEMBERED TODAY FOR HIS INVENTION OF THE SINGLE WIRE TELEGRAPH SYSTEM AND MORSE CODE
Note: use the files: message1.txt and message2.txt in the Trinket, do not copy the morse code above into your program.
Automated feedback for this assignment is still under construction. Submitted programs are checked for syntax errors and their source code is checked for potential errors, bugs, stylistic issues, and suspicious constructs. However, no checks are performed yet to see if the program correctly implements the behaviour specified in the assignment.