Answered Essay: Write a program that asks for the names of three each of them to finish a race. The program should order that they finished. The

media%2F2b3%2F2b348133-1f3d-4035-95fa-bb

Write a program that asks for the names of three each of them to finish a race. The program should order that they finished. The following table shows the approximate speed of Write a program that asks the user to enter “air”, sound wave will travel in the median. The it will take. You can calculate the amount following formula: Time = Distance/1,100 can calculate the amount of time it takes

Expert Answer

 

11) C++ Code
#include<iostream>

#include<string>

#include<iomanip>

using namespace std;

/**

* User defined function to input the name of players and their finish race time

*

*/

void inputPlayerDetails(string &player1, string &player2, string &player3, double &time1,

double &time2, double &time3)

{

cout<<“nEnter the name of Player 1: “;

getline(cin >> ws, player1);

cout<<“Enter the time in which the player-> “<<player1<<” finished the race: “;

cin >> time1;

cout<<“nEnter the name of Player 2: “;

getline(cin >> ws, player2);

cout<<“Enter the time in which the player-> “<<player2<<” finished the race: “;

cin >> time2;

cout<<“nEnter the name of Player 1: “;

getline(cin >> ws, player3);

cout<<“Enter the time in which the player-> “<<player3<<” finished the race: “;

cin >> time3;

}

// main function

int main()

{

string player1, player2, player3;

double time1, time2, time3;

inputPlayerDetails(player1, player2, player3, time1, time2, time3);

cout<<“n*** Order in which the players finished the race ***”<<endl<<endl;

cout<<“Position”<<setw(12)<<“Player”<<setw(15)<<“Time (s)”<<endl<<endl;

if(time1 <= time2 && time1 <= time3 && time2 <= time3)

{

cout<<setw(3)<<“1″<<setw(15)<<player1<<setw(15)<<time1<<endl;

cout<<setw(3)<<“2″<<setw(15)<<player2<<setw(15)<<time2<<endl;

cout<<setw(3)<<“3″<<setw(15)<<player3<<setw(15)<<time3<<endl;

}

else if(time2 <= time1 && time2 <= time3 && time1 <= time3)

{

cout<<setw(3)<<“1″<<setw(15)<<player2<<setw(15)<<time2<<endl;

cout<<setw(3)<<“2″<<setw(15)<<player1<<setw(15)<<time1<<endl;

cout<<setw(3)<<“3″<<setw(15)<<player3<<setw(15)<<time3<<endl;

}

else if(time3 <= time2 && time2 <= time1 && time3 <= time1 )

{

cout<<setw(3)<<“1″<<setw(15)<<player3<<setw(15)<<time3<<endl;

cout<<setw(3)<<“2″<<setw(15)<<player2<<setw(15)<<time2<<endl;

cout<<setw(3)<<“3″<<setw(15)<<player1<<setw(15)<<time1<<endl;

}

else if(time3 <= time2 && time1 <= time2 && time3 <= time1)

{

cout<<setw(3)<<“1″<<setw(15)<<player3<<setw(15)<<time3<<endl;

cout<<setw(3)<<“2″<<setw(15)<<player1<<setw(15)<<time1<<endl;

cout<<setw(3)<<“3″<<setw(15)<<player2<<setw(15)<<time2<<endl;

}

else

{

cout<<setw(3)<<“1″<<setw(15)<<player2<<setw(15)<<time2<<endl;

cout<<setw(3)<<“2″<<setw(15)<<player3<<setw(15)<<time3<<endl;

cout<<setw(3)<<“3″<<setw(15)<<player1<<setw(15)<<time1<<endl;

}

}

————————————————————————————————————————————————

OUTPUT

12 ) C++ Code
#include<iostream>

#include<string>

#include<iomanip>

# define AIR_SPEED 1100

# define WATER_SPEED 4900

# define STEEL_SPEED 16400

using namespace std;

int main()

{

string medium;

double distance;

cout<<“nEnter the medium in all lower case (air / water / steel): “;

getline(cin >> ws, medium);

cout<<“Enter the distance in feet travelled in “<<medium<<“: “;

cin >> distance;

if(medium == “air”)

{

cout<<“nTime required by the sound to travel a distance of ” <<distance

<<” feetnin the medium “<<medium<<” is: ”

<<setprecision(4)<<(distance / AIR_SPEED)<<” seconds”;

}

else if(medium == “water”)

{

cout<<“nTime required by the sound to travel a distance of ” <<distance

<<” feetnin the medium “<<medium<<” is: ”

<<setprecision(4)<<(distance / WATER_SPEED)<<” seconds”;

}

else if(medium == “steel”)

{

cout<<“nTime required by the sound to travel a distance of ” <<distance

<<” feetnin the medium “<<medium<<” is: ”

<<setprecision(4)<<(distance / STEEL_SPEED)<<” seconds”;

}

else

{

cout<<“nInvalid medium.”<<endl;

}

}

———————————————————————————————-

OUTPUT

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.