$30
Project 3 Description
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
Air
1100
Water
4900
Steel
16400
Write a C++ 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 4 decimal places.
Input validation: decide how the program should handle an illegal input for the menu choice or distance.
A few examples:
The Speed of Sound
****************
Press 1 for Air
Press 2 for Water
Press 3 for Steel
****************
Your choice: 4
Invalid menu choice.
The Speed of Sound
****************
Press 1 for Air
Press 2 for Water
Press 3 for Steel
****************
Your choice: 3
Enter the number of feet: -5
Invalid number of feet entered.
The Speed of Sound
****************
Press 1 for Air
Press 2 for Water
Press 3 for Steel
****************
Your choice: 2
Enter the number of feet: one hundred thousand
Invalid number of feet entered.
The Speed of Sound
****************
Press 1 for Air
Press 2 for Water
Press 3 for Steel
****************
Your choice: 2
Enter the number of feet: 100000
It will take 20.4082 seconds for sound to travel through 100000 feet of water.
To Do:
1. Upload your .cpp file to the Project 3 Drop Box.
2. Be sure to check the Rubrics before you submit your Project. Rubrics tell you exactly what must be included in each Project and how much each item is worth.
3. Check the Calendar for the due date.