The Speed of Sound
The speed of sound depends on the material the sound is passing through. Below is the approximate speed of sound (in feet per second) for air, water and steel:
air: 1,100 feet per second
water: 4,900 feet per second
steel: 16,400 feet per second
Write a program that displays a menu allowing the user to select air, water, or steel. After the user has made a selection, he or she should be asked to enter the distance a sound wave will travel in the selected medium. The program will then display the amount of time it will take.
Menu. The menu should look exactly like this:
Select a medium: 1. Air 2. Water 3. Steel
Enter your choice:
Prompts And Output Labels. After the user chooses the medium, prompt for distance simply with the string "Enter the distance: ". After each calculation, your output should be of the form "A sound wave takes T seconds to travel D feet in M." where T is the time you calculated to 4 digits of precision, D is the distance entered and M is the medium (air/water/steel) selected.
Input Validation. The program should validate both the menu choice and the distance entered. If the menu choice is not 1 or 2 or 3 then the program prints "The valid choices are 1 through 3. Run the program again and select one of those." and terminates. The distance must not be negative-- otherwise the program prints out the message "Distance must be greater than zero." and terminates.
A++ solution for this question
Solution contain C++ program and screenshot
Using DevC++ IDE to run program.
If you want run on Visual studio, you can edit some lines in source code (i can help you do it).