The following table shows the approximate speed of sound in air, water, and steel.
Medium Speed
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 ask 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 (round the answer to 4 decimal places). Input validation: check that the user has selected one of the available choices from the menu.Do not accept distances less than 0.
Breaking it down
Create variables
Create distance travelled method
Get input from user
Calculate and display output
Output
Unit tests
Level Up
Validate the users inputs for air/water/steel
Create ENUM OR constants for air/water/steel, be sure to update the test!
Allow the user to enter have the ability to show the feet per second in time. adjust the getDistanceTraveledInSeconds -> getDistancedTraveled