CSCI 2341 Submission 05
Graphs of Airplane Flight Routes
| Supplied file(s) (copy from $sup05) |
DemoFlightRoutes.jar (the demo executable)FlightRoutes.txt (the TextItems file of program
description) flights_world.txt (a sample input file of flight route
data)
The following files are from zyBook Section 10.7: Graph.java (the Graph class for the Graph implementation)
Vertex.java (the Vertex class for the Graph
implementation) Edge.java (the Edge class for the Graph implementation)
|
|---|---|
| Files to submit |
FlightRoutes.jar (your executable jar file)FlightRoutes.java (your source code file)my_tests.sh (your completed testing script)
|
| Where to put them | Copy them to your u##/submissions/s05 folder |
| When they're due | Sun, Nov 30, 2025 @11:59pm |
This week your task is to write a program that can read an input file of text containing information about airplane flight routes and display a list of all routes to or from a given city, along with the distance in miles between the cities on each route. On each run of the program the user must supply the file containing all the information, the name of the city of interest, and whether the user is requesting a list of all flights to the city or from the city.
Once again your final result must be an executable jar file that performs in the same way as the demo executable.
uxx account.
sample_flight_data.txt and
note the format (which is described below). Then run the demo executable
with this file input, along with either "to" or "from" and the name of
one of the cities in the file. Continue this experimentation until you
understand how your program is to work, since its behavior must replicate
the behavior of the sample executable.
my_tests.sh testing script.
submissions/s05 directory in your u## account.
flights_world.txt
to explain the format of the flight route data. Here are the contents of
this file (11 lines):
4
Tokyo
New York
London
Sydney
0 1 6743
0 2 5941
0 3 4863
1 2 3425
1 3 9868
2 3 10562
The first line of the file contains the integer 4, which indicates that
this file contains information on flight routes between four citites, and
those four cities are listed on the next four lines. We make the
simplifying but entirely reasonable assumption that if there is a flight
route from city A to city B, then there is also a corresponding flight
route from city B to city A, and of course the number of miles is the
same no matter in which direction you travel. The rest of the lines in
the file give the distances between cities in the third column. The first
two columns contain the "index" values for the cities, with (in this
case) Tokyo at index 0, New York at index 1, London at index 2, and
Sydney at index 3. With this in mind, we can see (for example) that the
line 0 2 5941 tells us that the route from Tokyo to London (or from
London to Tokyo) is 5941 miles, and the line 1 3 9868 tells us that the
route from New York to Sydney (or from Sydney to New York) is 9868 miles.
A file with more cities would be formatted in a similar manner.