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.)

Respuesta :

Answer:

// Program is written in C++ Programming Language

// Comments are used for explanatory purpose

// Program starts here

#include<iostream>

using namespace std;

int main ()

{

// Declare Variable

int selection;

// Prompt user to make a selection of medium between air, water or steel.

cout<<"Make Selection"<<'\n'<<"Press 1 for Air"<<'\n'<<"Press 2 for Water"<<'\n'<<"Press 3 for Steel";

cin>>selection;

// Check for entry

if(selection == 1) {

cout<<"You selected Air"<<'\n';

cout<<"The distance travelled by sound wave in air is 1,125 feet in 1 second";

}

else if(selection == 2) {

cout<<"You selected Water"<<'\n';

cout<<"The distance travelled by sound wave in water is 4859 feet in 1 second";

}

else if(selection == 3) {

cout<<"You selected Steel"<<'\n';

cout<<"The distance travelled by sound wave in steel is 19554 feet in 1 second";

}

else

cout<<"Invalid Selection";

return 0;

}