Answer to Question #264720 in C++ for Ahsan wains

Question #264720

You will be simulating an airport where 8 planes go out on tours repeatedly. Each tour will be



for exactly 12 passengers and last approximately 30 seconds. In performing the simulation,



you must make sure that no plane tries to leave a gate with less (or more) than 12 passengers



and that no plane lands or takes off at the same time as another plane is landing or taking off.



The first thing your program should do is read the following from the command line (in the



order specified):



• the total number of passengers that are in the airport.



• the sum total number of tours that all of the planes are to do. (NOT the number of tours



that each plane is to do, the total number of tours that all planes will do when their



number of completed tours is added together.

1
Expert's answer
2021-11-12T00:07:29-0500
#include<iostream>
using namespace std;
int main()
{
	int n,total;
	cout<<"Enter the total passangers on the airport: ";
	cin>>n;
	cout<<"Enter the total number of tours that the planes should take: ";
	cin>>total;
	int tot=total/8;
	cout<<"total trip per plane: "<<tot<<endl;
	int trip=n/8;
	cout<<"total passengers of a plane: "<<trip<<endl;
	int sum=trip/12;
	cout<<"number of trips in a plane: "<<sum<<endl;
	for(int i=1;i<=sum;i++){
	cout<<"Plane 1 takes off and takes 30 seconds before it lands"<<endl;
	cout<<"Plane 2 takes off for the next 30 seconds before it lands "<<endl;
	cout<<"Plane 3 takes off for the next 30 seconds before it lands "<<endl;
	cout<<"Plane 4 takes off and takes 30 seconds before landing"<<endl;
	cout<<"Plane 5 takes off and takes 30 seconds before it lands "<<endl;
	cout<<"Plane 6 takes off and takes 30 econds before it lands "<<endl;
	cout<<"Plane 7 takes off and takes 30 econds before it lands "<<endl;
	cout<<"Plane 8 takes off and takes 30 econds before it lands "<<endl;
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS