Question: Problem Statement: Finding the flight itinerary to reach the destination at earliest possible time. Write a Java or C + + program that can handle
Problem Statement: Finding the flight itinerary to reach the destination at earliest possible time.
Write a Java or C program that can handle the following.
Suppose you want to leave from Baton Rouge airport BTR and reach Providence PVD You can leave as
early as : am in the morning. You want to find out an itinerary which results in you reaching PVD at
the earliest possible time. You will write Graph.java or Graph.cpp which will take command line
arguments BTR PVD will output the itinerary:
EV BTR ATL
DL ATL PVD
This means or : pm is the earliest time we can reach PVD among all possible flight itineraries.
More specifically, you are given two files:
airports.txt: There are unique airport codes.
flights.txt: These are flights which operate or once operated daily between US airports.
You will model this as a graph. Each airport will be a vertex and each flight will be an edge. Notice that
there may be multiple edges between same two vertices. Also, these edges are directed. Instead of
weight as in distance for the regular Dijkstras algorithm here each edge is annotated with departure
time and arrival time. Regardless of these differences, we can modify Dijkstras algorithm for this
purpose.
Usual Dijkstras algorithm minimizes distance, and each vertex v has an associated distance value dv
that stands for shortest distance from source s to v as we know so far based on the edges explored. In
the case of flight itinerary, dv or dvalue stands for earliest possible time we can reach v based on flights
data explored so far.
Input File: Input files flightstxt and airports.txt will be provided separately. Your program
should take command line arguments Source airport, Destination airport and beginning time
For example, lets take two airports, Miami MIA and Tulsa County TUL The threeletter
codes of the airports and beginning time will be passed as command line arguments as follows.
C Program
Compile: go Graph Graph.cpp
Run: Graph MIA TUL
Java Program
Compile: javac Graph.java
Run: java Graph MIA TUL
Output: For the gradescope submission, the output should be the number representing the
earliest possible arrival time, followed by a newline. For example, the itinerary for the above
mentioned input ie source MIA, destination TUL and beginning time is
AA MIA DFW
AA DFW STL
WN STL TUL
Your code on gradescope submission should display only as the final output followed by a newline.
Submission: This is a group project. You may create a group of up to people. Please mention
names of all the teammembers as a comment at the top of your code. Also, mention this by making a
groupsubmission on gradescope. For this, on the Manage Submissions page, in the bottom action bar,
click 'Group Members' to add the other group member. Submit the file Graph.cpp or Graph.java to
gradescope. Gradescope will run few custom test cases and return the result of the test. If everything
goes well, you will get full credit. Additionally, if it fails, then you can submit it as many times as you want
before the deadline.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
