Complete the solution to the HPAir problem. The input to the program consists of three text files, as follows:
cityFile Each line contains the name of a city that HPAir serves. The names are in alphabetical order.
flightFile Each line contains a pair of city names that represents the origin and destination of one of HPAir’s flights.
requestFile Each line contains a pair of city names that represents a request to fly from some origin to some destination.
You can make the following assumptions:
■ Each city name contains at most 15 characters. Pairs of city names are separated by a comma.
■ HPAir serves at most 20 cities.
■ The input data is correct.
For example, the input files could appear as
cityFile: | Albuquerque Chicago San Diego | |
flightFile: | Chicago, | San Diego |
Chicago, | Albuquerque | |
Albuquerque, | Chicago | |
requestFile: | Albuquerque, | San Diego |
Albuquerque, | Paris | |
San Diego, | Chicago |
For this input, the program should produce the following output:
Request is to fly from Albuquerque to San Diego.
HPAir flies from Albuquerque to San Diego.
Request is to fly from Albuquerque to Paris.
Sorry. HPAir does not serve Paris.
Request is to fly from San Diego to Chicago.
Sorry. HPAir does not fly from San Diego to Chicago.
Begin by implementing the ADT flight map as the Java classMap. Use the nonrecursive version ofisPath. SincegetNextCity is the primary operation that the search algorithm performs on the flight map, you should choose an implementation that will efficiently determine which cities are adjacent to a given city. If tire re areN
cities, you can useN linked lists to represent the flight map. You place a node on listi for cityj if and only if there is a directed path from cityi to cityj. Such a data structure is called an adjacency list; Figure 7-19 illustrates an adjacency list for the flight map in Figure 7-10. Chapter 14 discusses adjacency lists further when it presents ways to represent graphs. At that time, you will learn why an adjacency list is a good choice for the present program.
Although you can implement the adjacency list from scratch, you should also consider using N instances ofListReferenceBased, which has a reference-based im pie mentation.
You must also create a classCity that implements diejava. lang.Comparable interface to store the city'’ name. The classCity and the previously described adjacency list are the underlying data structures for the ADT flight map.
To simplify reading the input text files, define a class that includes the following methods:
+getName():String
//Gets a name from the next line in a text file.
+getNamePair():String
//Returns a string containing the two names from the next //line in a text file.

Adjacency list for the flight map in Figure 7-10
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.