e named constants for numeric literals in the program and do not use global variables. The Speed of Sound – The speed of sound varies depending on the medium through which it travels. In general, sound travels fastest in rigid media ,such as steel, slower in liquid media, such as water, and slowest of all in gases, such as air. The following table shows the approximate speed of sound, measure in feet per second in air water and steel. Medium Sp
Do in C++ and also provide an IPO
*use named constants for numeric literals in the
The Speed of Sound – The speed of sound varies depending on the medium through which it travels. In general, sound travels fastest in rigid media ,such as steel, slower in liquid media, such as water, and slowest of all in gases, such as air. The following table shows the approximate speed of sound, measure in feet per second in air water and steel.
Medium |
Speed (feet per sec) |
Air |
1,100 |
Water |
4,900 |
Steel |
16,400 |
|
|
Write a program that displays a menu allowing the user to select air, water, or steel, and then has the user enter the number of feet a sound wave will travel in the selected medium. The program should then compute and display (with four decimal places) the number of seconds it will take. Your program should check if the user enters a valid menu choice, if not, it should terminate with an appropriate message.
Design: First use an IPO chart to design your program, showing inputs, outputs, and process written in pseudocode and use your chart to write your program.
Sample Dialog/Output
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images