The project will read flight data from an input file andflight path requests from another input file and output the requiredinformation.
?
Your Task
Your program should determine if aparticular destination airport can be reached from a particular originatingairport within a particular number of hops.
A hop (leg of a flight) is a flight from one airport to anotheron the path between an originating and destination airports.
For example, the flight plan from PVG to PEK might be PVG→ CAN → PEK. So PVG → CAN would be a hop and CAN → PEK would be a hop.
?
Input Data Files
Path InputFile(PathInput.txt)
This input file will consist of a number of single origination/destinationairport pairs (direct flights). The first line of the file will contain aninteger representing the total number of pairs in the rest of the file.
6
[PVG, CAN]
[CAN, PEK]
[PVG, CTU]
[CTU, DLC]
[DLC, HAK]
[HAK, LXA]
?
PathRequest File(PathRequest.txt)
This input file will contain a sequence of pairs oforigination/destination airports and a max number of hops. The first line ofthe file will contain an integer representing the number of pairs in the file.
2
[PVG, DLC, 2]
[PVG, LXA, 2]
?
OutputFile(Output.txt)
For each pair in the Path Request File, your programshould output the pair followed by “YES” or “NO” indicating that it is possible to get from the origination to destinationairports within the max number of hops or it is not possible,respectively.
[PVG, DLC, YES]
[PVG, LXA, NO]
Assumptions youcan make:
You may make the following simplifying assumptions inyour project:
l? All airport codes will be 3 letters and will be in allcaps
l? Origination/destination pairs are unidirectional. Toindicate that both directions of flight are possible, two entries would appearin the file. For example, [PVG, PEK] and [PEK, PVG] would have to be present inthe file to indicate that one could fly from Shanghaito Beijing and from Beijingto Shanghai.