Sale!

# COP2000 Project 3 solved

Original price was: \$35.00.Current price is: \$30.00.

Category:

## 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
****************

The Speed of Sound

****************
Press 1 for Air
Press 2 for Water
Press 3 for Steel
****************

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
****************

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
****************