Morse Code Generation

In determining the speed of transmission of messages in Morse code, the controlling element is the dot, ‘.’. The dash, ‘-’, is three dots in length. Within a character the space between sounds (intra-character space) is considered to be at least a dot in length. The inter-character space is at least a dash in length and the interword space is three dashes in length. It is assumed that each word is five characters in length. For transmission speeds below thirteen (13) words-per-minute, the individual characters are formed using the dot length of thirteen words per minute, with the extra time placed on the intra-character spaces. Then the inter-character space is three times the intra-character space, and the interword space is three times the inter-character space. Thus at 6.5 words per minute, the inter-character space is twice that of a 13 wpm transmission. Above 13 wpm, both the character time and the intra-character spacing are controlled by the speed. For the purpose of this problem assume that the average character is eight (8) dots in length. Thus for a standard of 13 wpm transmission there would be 135=65 characters per minute or 658=520 dot spaces per minute (and 520 intra-character spaces per minute). You are to use this value for the basis of your program. Input A file consisting of: • A table with all the different characters (one character to a line) which are used in the messages to be sent. Each character is followed by its Morse code representation as a series of ‘-’ and ‘.’. For a complete set of possible characters, look at the table below the problem description. • It follows one or more data sets. Each of them begins with a ‘@’ in column 1 on a line by itself. Then a line with an integer indicating the transmission speed in words-per-minute. This is followed by the message to be sent. For the purpose of transmission, end-of-line characters (except the last of each message) must be considered as an interword space. Output A copy of the message to be sent, one character (an upper case letter or a number) per line followed by a listing, as integers of the number of milliseconds the transmitter will be on and the number of milliseconds the transmitter will be off to result in the desired speed. Each time is to be preceeded and followed by a white space. Sound times will be followed by a single character ‘S’ and no sound times will be followed by a single character ‘N’. The required inter character spacing will be the last entry in a line. Each line will be terminated by a new line character. A blank line separates the output of two messages Complete set of characters: Below is a table of the characters which can be used for testing and their Morse Code representation. A .- B -... C -.-. D-.. M-- V...- 1 .---- 2 ..--- 3 ...-- 4 ....- J .--- K -.- L .-.. S ... T - U ..-

2/2 E. F ..-. G --. H .... I .. Sample Input A .- B -... D -.. G --. O --- Y -.-- @ 5 A BAD BOY @ 13 A good boy Sample output N -. O --- P .--. Q --.- R .-. W .-- X -..- Y -.-- Z --.. 0 ----- 5 ..... 6 -.... 7 --... 8 ---.. 9 ----. A 115 S 115 N 345 S 115 N 1428 N 4284 N B 345 S 115 N 115 S 115 N 115 S 115 N 115 S 115 N 1428 N A 115 S 115 N 345 S 115 N 1428 N D 345 S 115 N 115 S 115 N 115 S 115 N 1428 N 4284 N B 345 S 115 N 115 S 115 N 115 S 115 N 115 S 115 N 1428 N O 345 S 115 N 345 S 115 N 345 S 115 N 1428 N Y 345 S 115 N 115 S 115 N 345 S 115 N 345 S 115 N 1428 N A 115 S 115 N 345 S 115 N 345 N 1035 N G 345 S 115 N 345 S 115 N 115 S 115 N 345 N O 345 S 115 N 345 S 115 N 345 S 115 N 345 N O 345 S 115 N 345 S 115 N 345 S 115 N 345 N D 345 S 115 N 115 S 115 N 115 S 115 N 345 N 1035 N B 345 S 115 N 115 S 115 N 115 S 115 N 115 S 115 N 345 N O 345 S 115 N 345 S 115 N 345 S 115 N 345 N Y 345 S 115 N 115 S 115 N 345 S 115 N 345 S 115 N 345 N