Answer to Question #156058 in C++ for jakruyh

Question #156058

Company ABC, an airline company is closely monitoring the distance between airplanes as they take-off on the same airport. You are asked to create a system that would calculate the distance between two planes A and B given the following plane attributes: Take-off Time, Speed (mi/hr), direction (north, east, west, south). Also, given the time where the navigation officer would like to check the distance.


1
Expert's answer
2021-01-16T12:33:05-0500
#include <iostream>

using namespace std;

int main()
{
    int flightNo1=0, flightNo2=0, speed1=0, speed2=0;
    char direction1[5];
    char direction2[5];
    int time1=0, time2=0, distance=0;
    cout<<"-----------You are welcome in ABC Airline Co.------------"<<endl;
    // First flight details
    cout<<" Please enter the flight name: "<< endl;
    cin>>flightNo1;
    cout<<"Please enter flight number:"<<flightNo1 <<"take off time:"<< endl;
    cin>>time1;
    cout<<"Please enter the speed of flight number:"<<flightNo1 << endl;
    cin>>speed1;
    cout<<"The speed of the flight number:"<<flightNo1<<"is:"<<speed1<<endl;
    cout<<"Please enter the direction of flight number:"<<flightNo1 << endl;
    cin>>direction1;
    cout<<"The direction of the flight number:"<<flightNo1<<"is:"<<direction1<<endl;
    
    // second flight detail
    cout<<" Please enter the flight Number of second flight "<< endl;
    cin>>flightNo2;
    cout<<"Please enter the take off time of the flightNo2 :"<<flightNo2<< endl;
    cin>>time2;
    cout<<"The take off time of flight number:"<<flightNo2<<"is:"<<time2<<endl;
    cout<<"Please enter the speed of flight number:"<<flightNo2 << endl;
    cin>>speed2;
    cout<<"The speed of the flight number:"<<flightNo2<<"is:"<<speed2<<endl;
    cout<<"Please enter the direction of flight number:"<<flightNo2 << endl;
    cin>>direction2;
    cout<<"The direction of the flight number:"<<flightNo2<<"is:"<<direction2<<endl;
    
    distance=speed1*time1-speed2*time2;
    cout<<"The distance between the two flights be:"<<distance<<endl;
    return 0;
}

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
APPROVED BY CLIENTS