You are at the Pittsburgh airport and have just learned that the charter flight that would take you to Costa Rica has been canceled. There are no other direct flights from Pittsburgh to Costa Rica. You need to find an alternative way to get there and as fast as possible (the volcanos, butterflies and cloud forests are waiting). You have collected flight information in a file such as flights1.txt. Each line of the file shows information about a flight. The first few lines show flights out of Pittsburgh (airport code PIT). The form of these lines is
PIT destination-code time-until-departure time-for-flight
Each destination-code is a 3-letter airport code. The code for Costa Rica is SJO (for San Jose, the capital). The times are integers and count the minutes involved. The first time is how long until the flight leaves from Pittsburgh and the second time is how long the flight takes.
After the flights departing Pittsburgh, there is information about flights between other airports, one per line in the form:
departure-code destination-code time-for-flight
Each code is a 3-letter airport code. The time for the flight is in minutes. It is assumed that the connection time at an airport other than PIT is always 60 minutes. So, there will be 60 minutes between the time a flight arrives and another one leaves. Thus, to fly from PIT to LAX and then to SJO, the flight time would be
departure time to LAX + flight time from PIT to LAX + 60 + flight time from LAX to SJO
You are to write a program that prompts for the name of the file containing the flight information. The program uses the information in the file and finds the fastest combination of flights to Costa Rica. The program should indicate the route to Costa Rica by displaying a sequence of airport codes for the airports used to reach the final destination. For flights1.txt, the display should be
PIT CLE SJO
The program must also display the total
number of minutes needed to reach Costa Rica using this route. For
flights1.txt, this is 420 minutes.