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 ... .. .- -..- -.-- --..

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
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
Transcribed Image Text: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
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.
Transcribed Image Text: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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

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 program should run until the user selects the "quit" option from your menu.

  • 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.

 
 
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education