Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Tips/help (I\'m not asking you write the entire code) on writing up a program fo

ID: 3667398 • Letter: T

Question

Tips/help (I'm not asking you write the entire code) on writing up a program for the following in Visual Studios C++

The speed of sound varies with medium in which it is travelling. In air the speed is 335.28 meters/second, in steel the speed is 4998.72 meters/second, and in water the speed is 1493.52 meters/second. Write a C++ program that will prompt the user to select a medium by entering a single upper case character (assume the user enters a correct upper case character) and enter a distance to be travelled. Use an if-elseif structure to determine the speed of sound in the medium. Next calculate how long it will take sound to travel that distance in the specified medium. Your output for the time should be shown using 5 significant digits and should look something like the following

  It will take ______________ seconds for sound to travel

     ____________ meters in ________________.  

Explanation / Answer

// c++ code

class calaculate

{

private:

   float aspeed=335.38,sspeed=49983.72,wspeed=1493.52;

   char ch;

   int meters;

public:

void calaculation()

{

    cout<<"enter in which medium u want to calculate the speed"

    cout<<"enter A for air and S for steel and W for water and all are uppper case letters only:";

    cin>>ch;

    cout<<"enter how much distance u want to travel...."

    cin>>meters;

    if(ch!='A' && ch!='S' && ch!='W")

     cout<<"enter valid upper case characters only "

     else if(ch=='A')

     {

       // code to calculate the speed in the air

     }

     else if(ch=='S')

    {

       // code to calculate speed in the steel

     }

      else

      {

       // calculate speed in the water

      }

     void printData()

    {

       // print the data in which formate you want to print

    }

}

}

// then create an object for the class calaculate after declaring in the main function and call the function calaculation using that object from the main() function and call the printData() function also. then you wil get output.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote