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.

Answers

Answer 1

To 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, follow the steps given below.

// Program to generate a bill for sending a telegram

#include <iostream>
#include <string>
#include <map>

using namespace std;

// Named constants to use in calculation
const int BLOCK_OF_5_WORDS = 5;
const double RATE_FOR_BLOCK = 1.50;
const double RATE_FOR_SINGLE_WORD = 0.50;

int main() {
   // Variables for user input
   int numWords;
   string message;

   // Create a map to store the morse code
   map<char, string> morseMap = {
       {'A', ".-"},
       {'B', "-..."},
       {'C', "-.-."},
       {'D', "-.."},
       {'E', "."},
       {'F', "..-."},
       {'G', "--."},
       {'H', "...."},
       {'I', ".."},
       {'J', ".---"},
       {'K', "-.-"},
       {'L', ".-.."},
       {'M', "--"},
       {'N', "-."},
       {'O', "---"},
       {'P', ".--."},
       {'Q', "--.-"},
       {'R', ".-."},
       {'S', "..."},
       {'T', "-"},
       {'U', "..-"},
       {'V', "...-"},
       {'W', ".--"},
       {'X', "-..-"},
       {'Y', "-.--"},
       {'Z', "--.."}
   };

   // Ask the user for the number of words in their telegram
   cout << "Please enter the number of words in your telegram: ";
   cin >> numWords;

   // Calculate the total bill
   double totalBill;
   if (numWords % BLOCK_OF_5_WORDS == 0) {
       totalBill = (numWords / BLOCK_OF_5_WORDS) * RATE_FOR_BLOCK;
   } else {
       totalBill = ((numWords / BLOCK_OF_5_WORDS) * RATE_FOR_BLOCK) + (numWords % BLOCK_OF_5_WORDS) * RATE_FOR_SINGLE_WORD;
   }

   // Display the bill to the user
   cout << "Your total bill is: $" << totalBill << endl;

   // Ask the user for the message they would like to translate into Morse Code
   cout << "Please enter the single letter you would like to translate into Morse Code: ";
   cin >> message;

   // Translate the single letter into Morse Code
   cout << "Your letter in Morse Code is: " << morseMap[message[0]] << endl;

   return 0;
}
The above code snippet will take input from the user and 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.

Learn more about Morse code here:

https://brainly.com/question/29290791

#SPJ11


Related Questions

The nozzle has a diameter of 40 mm. Assume water is ideal fluid, that is, incompressible and frictionless (Figure 1) Part A If it discharges water with a velocity of 20 m/s against the fixed blade, determine the horizontal force exerted by the water on the blade. The blade divides the water evenly at an angle of θ-45° Express your answer to three significant figures and include the appropriate units. Figure 1 of 1 F-Value Units 40 mm Submit Request Answer Provide Feedback Next

Answers

From the given information, we can calculate the flow rate of water through the nozzle as follows:

Q = A * V

where Q is the flow rate, A is the cross-sectional area of the nozzle, and V is the velocity of the water.

The cross-sectional area of the nozzle can be calculated as:

A = (π/4) * d^2

where d is the diameter of the nozzle.

Substituting the given values, we get:

A = (π/4) * (0.04 m)^2 = 0.0012566 m^2

The flow rate can now be calculated as:

Q = A * V = 0.0012566 m^2 * 20 m/s = 0.02513 m^3/s

The force exerted by the water on the blade can be calculated using the momentum equation:

F = ρ * Q * V * tan(θ-45°)

where ρ is the density of water, and θ is the angle at which the water hits the blade.

Assuming a density of water to be 1000 kg/m^3, we get:

F = 1000 kg/m^3 * 0.02513 m^3/s * 20 m/s * tan(θ-45°)

Substituting θ = 45° (since the water is hitting the blade at an angle of θ-45°), we get:

F = 1000 kg/m^3 * 0.02513 m^3/s * 20 m/s * tan(0°) = 0 N

Therefore, the horizontal force exerted by the water on the blade is 0 N. This is because the water hits the blade at a perpendicular angle and there is no component of force in the horizontal direction.

To know more about nozzle click here:

brainly.com/question/30896816

#SPJ4

to submit tenders for a structure to help people safely cross the river at KwaDukuza The Thukela Municipality placed a tender request in the newspaper asking contractors village. Municipalities are not allowed to choose a contractor without giving as many contractors as possible a chance to apply. This is to stop anyone from being favoured over others, and to prevent corruption. Each contractor writes a tender document, which is a description of their plan for the project and shows how much they will charge to complete the work. The job is given to the contractor who presents the best plan at the lowest price. You are going to build a structure to help the community. Read the story again and then investigate the different bridges below to decide which structure will be the best solution for the problem.​

Answers

Answer:

In general, the choice of bridge design will depend on various factors such as the location, the environment, the length of the span, the expected traffic, the budget, and the construction time. Different types of bridges, such as beam bridges, arch bridges, suspension bridges, and cable-stayed bridges, have different strengths and weaknesses, and are suitable for different situations.

Some factors to consider when choosing a bridge design include:

Span: If the river is wide, a longer span bridge such as a suspension or cable-stayed bridge may be required.

Location: The local geology, topography, and environmental conditions may dictate the type of bridge that can be built.

Budget: Some bridge designs are more expensive than others. A beam bridge may be the most cost-effective option.

Traffic: If the bridge will carry heavy vehicles or high volumes of traffic, a stronger, more durable bridge such as a cable-stayed bridge may be required.

Ultimately, the choice of bridge design will depend on a careful evaluation of these factors and the needs of the community. It is important to consult with experts and stakeholders to ensure that the chosen design is safe, effective, and meets the requirements of the project.

Explanation:

ANSWER : PONTOON BRIDGES

OR SUSPENSION BRIDGES

PONTOON BRIDGES:

take a bunch boats or rafts

tie them together

put a path/road on top of them

if a boat can carry a truck then so can a pontoon bridge

armies use them

smaller cost & safe

SUSPENSION BRIDGES:

source of strength its flexibility to wind,gravity, physical considerations

can be made of steel

but even cheaply with rope or jute etc.

When considering the strength in terms of load-bearing capacity and versatility, truss bridges are often considered to be the strongest type of bridge. Truss bridges are made up of interconnected triangles that distribute weight evenly across the structure, making them highly resistant to bending and compression forces. They are also relatively easy to construct using simple materials such as wood or steel, which may make them a more practical option for underserved communities.

That being said, arch bridges can also be quite strong and durable, as they rely on the inherent strength of their curved shape to distribute weight. Suspension and cable-stayed bridges, on the other hand, require more advanced engineering and construction techniques, and may be less feasible for communities with limited resources. Beam bridges are typically the simplest type of bridge, but may not be as strong or versatile as truss or arch bridges.

ChatGPT

Determine the moment of the force about point O. Assume F = 750 lb. (Figure 1) Express your answer to three significant figures and include the appropriate units.

Answers

The moment of the force is 3750 lb-ft, where lb-ft stands for pound-feet, the unit of torque or moment.

To determine the moment of the force about point O, we need to calculate the perpendicular distance between the line of action of the force and point O. From the figure, we can see that the distance is given by the distance between points O and B, which is 5 feet. Therefore, the moment of the force about point O is given by:

Moment = F x d = 750 lb x 5 ft = 3750 lb-ft

Torque, also known as moment or moment of force, is a measure of the twisting force that causes an object to rotate around an axis or pivot point. It is a vector quantity, which means it has both magnitude and direction. The magnitude of torque is given by the product of the force applied and the perpendicular distance between the axis of rotation and the line of action of the force.

Find out more about torque

brainly.com/question/29995495

#SPJ4

Other Questions
because 1920s prosperity had depended on a few basic industries, one factor that likely contributed to the length and severity of the great depression was ______. Which of these statements about lymphocytes is false?They mostly occur in lymphoid tissues.They are phagocytic.They occur as B, T, and NK types.They bind antigens. what is the expected color of the starch complex formed during this experiment?(A) The.correct answer is not shown. (B) orange-red (C) green (D) blue-black (E) yellow In an experimental situation, a student researcher inserts an mRNA molecule into a eukaryotic cell after she has removed its 5' cap and poly-A tail. Which of the following would be expected her to find?a. the mRNA is quickly converted into a ribosomal subunitc. the mRNA attaches to a ribosome and is translated, but more slowly.d. the molecule is digested by enzymes because it is not protected at the 5' endExplain the choice. which of these is the second of the three stages of cell signaling? Which of the following is NOT a way consciousness aids survival, according to evolutionary psychologists?A) Consciousness helps us cope with new situations.B) Consciousness helps us act in our long-term interests.C) Consciousness helps us seek short-term pleasures.D) Consciousness helps us anticipate how others view us. a device that receives information from a computer is an _________________________. Use your knowledge of contemporary situational leadership theory to choose the word or phrase that best describes the situation.a. If your leader allows you to share in decision-making responsibility, which leadership style will he or she use?b. Delegate stylec. Selling styled. Participating stylee. Storytelling style Why is the following not a probability? model?LOADING...Click the icon to view the data table.Determine why it is not a probability model. Choose the correct answer below.A.This is not a probability model because at least one probability is greater than 0.B.This is not a probability model because at least one probability is greater than 1.C.This is not a probability model because the sum of the probabilities is not 1.D.This is not a probability model because at least one probability is less than 0 what is the name of the lymphatic tissue located in the small intestine and appendix? Please simplify the following expression while performing the given operation.(-3+i)+(-4-i) To stretch a spring 5.00cm from its unstretched length, 19.0J of work must be done.1- what is the force constant of the spring ?2- What magnitude force is needed to stretch the spring 5.00cm from its unstretched length?3- How much work must be done to compress this spring 4.00 cm from its unstretched length?4-What force is needed to stretch it this distance? Which of the following techniques is heavily used to contact alters in the case of dissociative identity disorder? A. Channeling B. Dream analysis The students are sampling a site in search of fossils from the Devonian period. Based on the chart, which of the following would be the most reasonable plan for the students to follow?Collecting fossils from rock layers deposited prior to the Permian period that contain some early vertebrate bones In history,a. evil tends to predominate overgood.b. reason will always win.c. the World Spirit is coming to self-consciousness.d. the individual proves to betriumphant. Which of the following is not one of the five questions that comprise the task of evaluating a companys resources and competitive position?A) What are the companys most profitable geographic market segments?B) How well is the companys present strategy working?C) Are the companys prices and costs competitive?D) Is the company competitively stronger or weaker than key rivals?E) What strategic issues and problems merit front-burner management attention? TRUE/FALSE.The Transport layer uses port numbers to identify the source and destination Application-layer protocol of the data that it contains. Conversion of G3P to RuBP energy and it is coupled to O requires; conversion of ATP to ADP + Pi releases; conversion of NADPH to NADP+ releases; conversion of ADP + Pi to ATP requires; conversion of NADP+ to NADPH Question 3 (1 point) Which feature is shared by both chloroplasts and mitochondria? Electrons flow from NAD(P)H to O2. They both have an outer membrane, and inner membrane, and a matrix. They both have proton gradient across their inner membrane. A proton gradient is counled to ATP synthesis What would happen to the light reactions if the Calvin cycle stopped conver NADPH to NADP+? The light reactions would speed up because plants need the Calvin cycle tu survive and increasing the light reactions increases the Calvin cycle. The light reactions would stop because NADP+ is needed to accept electron from the light reactions. The light reactions would continue because they make NADPH for the Calvin cycle but do not depend on the Calvin cycle for anything. The light reactions would continue because all they require is light and water to make O2 and ATP. Next Page Page 2 of 3 25 esc FS F2 80 3 999 54 ES $ & 1 2 3 4 % 5 6 7 Q tab W E R T Y A S D F cans lock G Conversion of G3P to RuBP energy and it is coupled to O requires; conversion of ATP to ADP + Pi releases; conversion of NADPH to NADP+ releases; conversion of ADP + Pi to ATP , requires; conversion of NADP+ to NADPH Question 3 (1 point) Which feature is shared by both chloroplasts and mitochondria? Electrons flow from NAD(P)H to O2. They both have an outer membrane, and inner membrane, and a matrix. They both have proton gradient across their inner membrane. Anrotan gradient is.coupled to ATP synthesis What would happen to the light reactions if the Calvin cycle stopped conven NADPH to NADP+? The light reactions would speed up because plants need the Calvin cycle t survive and increasing the light reactions increases the Calvin cycle. The light reactions would stop because NADP+ is needed to accept electron from the light reactions. The light reactions would continue because they make NADPH for the Calvin cycle but do not depend on the Calvin cycle for anything. The light reactions would continue because all they require is light and water to make O2 and ATP. Next Page Page 2 of 3 Call please choose the term used to describe the type of antimicrobial resistance that is of most concern today. multiple choice: A) native B) mutational C)intrinsic D) acquired E) inherent Dorothy just celebrated her 90th birthday with her close friends, and is excited about a visit from her grandchildren. According to Erikson, she has probably most recently achieved