below to translate letters into Morse code. Letter Encoding A, a B, b C, c D, d E, e F. f G, g H, h I, i - -.-. ... --. .... .. Letter Encoding J, j K, k L, 1 M, m N, n 0,0 P, p Q,9 R, r --- -.- -- -. -- --- .-. Letter Encoding S, s T, t U, u V, V W, W X, X Y, y Z, z ... .. .- -..- -.-- --..
![In the 1850's, the hottest new technology was the telegraph. Messages or telegrams could be sent via electrical
forces traveling through a wire. Write a program that will generate a bill for sending a telegram and give the user
the opportunity to translate a message into Morse code. The amount owed for sending a telegram is based on the
number of words sent. Customers are charged at a rate of $1.50 for blocks of 5 words and $0.50 for single words.
Named constants must be used in the calculation. For now, your program will only translate a single letter into
Morse code. In the next project, you will add the functionality to translate an entire message. Use the tables
below to translate letters into Morse code.
Letter Encoding
A, a
B, b
C, c
D, d
E, e
F, f
G, g
H, h
I, i
-.-.
Letter Encoding
J, j
K, k
L, 1
M, m
N, n
0,0
P, p
Q, q
R, r
--
Letter Encoding
S, s
T, t
U, u
V, V
W, W
X, X
Y, Y
Z, Z
-..-
---
Get Help](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F26954cbc-ee18-423d-a73e-1fabe9c3bf7e%2F3537a17f-47d7-4381-a091-9ea900497670%2F25qwfm_processed.jpeg&w=3840&q=75)
![Steps:
1. Code a menu to offer the user the choice of processing a telegram bill or translating a message into Morse
code. The menu should be the first thing displayed when your program begins executing. The menu format
should match the one in the Sample Output.
2. Validate the user's menu choice. If the user enters any number other than 1 or 2, a descriptive error
message should display and the program should end without performing any calculations or prompting the
user for input.
3. If the user chooses option 1, your program should prompt them for the customer's name, street address,
city, state, zip code and number of words sent and then calculate and display a telegram bill with all
information specified in the Sample Output.
4. If the user chooses option 2, your program (for now) should prompt the user for a single letter and then
display the corresponding Morse code. If the user's input cannot be translated into Morse code, then a
descriptive error message should display. Your program should translate both upper and lower case letters.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F26954cbc-ee18-423d-a73e-1fabe9c3bf7e%2F3537a17f-47d7-4381-a091-9ea900497670%2Fuub8559_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Add the ability to convert an entire message into Morse code, as well as the ability to handle a data file comprising numerous entries. Change your input validation code so that the user has an infinite number of opportunities to enter valid responses. Your
- Add a menu option to provide the user the option of processing a data file. Add another way to exit the program. When your software starts, the menu should be the first item that appears. The menu format should be the same as in the Sample Output.
- Allow the user to make more menu selections until they select the option to exit. Before soliciting the user for a menu selection, always show the menu. Handle an incorrect menu option correctly. The user should have an infinite number of opportunities to enter a valid menu option.
- Validate the user's input for the number of words sent so that numbers less than one are not accepted. Allow the user an unlimited number of attempts to enter a proper figure for the number of words sent.
- Modify the code from Project 2 to convert a single letter to Morse code. Your code should now be able to efficiently transform any length message into Morse code. All white spaces in the message should be converted into three Morse code white spaces.
- If any part of the message cannot be translated into Morse code, your code should display the untranslated character rather than an error message.
- Add functionality to create and display telegram bills by reading input from the TelegramData.txt text file. When the user selects the option to process a data file, telegram bills should be created and displayed for every record in the file without the user needing to do anything else. See the Sample Output for what the bill must contain. The TelegramData.txt file contains 5 records, but your program must be able to process an identically formatted file with any number of records without counting the records.
Sample Output (user response shown in bold)
Welcome to Western Union Telegraph Company
1 – Process Telegram Bill
2 – Translate to Morse code
3 – Process a Data File
4 - Quit
Enter your choice: 2
Enter a message: That’s it!
Translation: - . . . . . - - ‘ . . . . . - !
Welcome to Western Union Telegraph Company
1 – Process Telegram Bill
2 – Translate to Morse code
3 – Process a Data File
4 - Quit
Enter your choice: 3
Leslie Knope
1456 Plymouth Street
Pawnee, IN 47408
Amount Owed: $35.50
Tom Haveford
689 Lil Sebastian Avenue
Pawnee, IN 47408
Amount Owed: $11.00
April Ludgate
1123 9th Avenue
Wamapoke, IN 48034
Amount Owed: $18.00
Jery Gergich
3124 Woodbridge Road
Eagleton, IN 47322
Amount Owed: $114.00
Donna Meagle
1200 Elysian Fields Blvd
Eagleton, IN 47322
Amount Owed: $73.50
Welcome to Western Union Telegraph Company
1 – Process Telegram Bill
2 – Translate to Morse code
3 – Process a Data File
4 - Quit
Enter your choice: 4
Thank you for using our program.
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)