Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The speed of sound varies depending on the medium through which it travels. In g

ID: 440697 • Letter: T

Question

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, measured in feet per second, in air, water, and steel.

Medium Speed(feet per sec.)

Air 1100

Water 4900

Steel16400

Write a program that displays a menu allowing the user to select air water, or steel. After the user has made a selection, the number of feet a sound wave will travel in the selected medium should be entered. The program will then display the amount of time it will take. (Round the answer to four decimal places.)

Input Validation: Check that the user has selected one of the available menu choices. Do not accept distances less than 0.

I am using Visual Studio 2010/Visual C++ 2010. So, my header would be #include <iostream> and the program would end with system("pause");. Thank you.

Explanation / Answer

//wasn't sure what you are familar with so wrote this with nothing more complex than switch statements #include #include #include using namespace std; int main(){ const int Air=1100,Water=4900,Steel=16400;//speed int choice; double time,feet; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote