Solved Flight Planning Java Programming Assignment: Determine all Possible Flight Plans for a Person


In this project, you will determine all possible flight plans for a person wishing to travel between two different cities serviced by an airline (assuming a path exists). You will also calculate the total cost incurred for all parts of the trip. For this project, you will use information from two different input files in order to calculate the trip plan and total cost.

  1. Origination and Destination Data – This file will contain a sequence of city pairs representing different legs of flights that can be considered in preparing a flight plan. For each leg, the file will also contain a dollar cost for that leg and a time to travel. For each pair in the file, you can assume that it is possible to fly in both directions.

  2. Requested Flights – This file will contain a sequence of origin/destination city pairs. For each pair, your program will determine if the flight is or is not possible. If it is possible, it will output to a file the flight plan with the total cost for the flight. If it is not possible, then a suitable message will be written to the output file.

The names of the two input files and the output file will be provided via command line arguments.

Flight Data:

Here is an example of a flight data input file (it does not go with Figure 1):






The first line of the file will contain an integer indicating how many rows of data will be in the file.  Each subsequent row will contain two city names, the cost of the flight, and the number of minutes of the flight.  Each field will be separated with a pipe (shift-\ on most keyboards).

Requested Flight Plans:

A sample input file for the requested flight plans is shown below.  The first line will contain an integer indicating the number of flight plans requested.  The subsequent lines will contain a pipe-delimited list of city pairs with a trailing character to indicate sorting the output of flights by time (T) or cost (C).  Your solution will find all flight paths between these two cities (if any exist) and calculate the total cost of the flights and the total time in the air.




Output File:

For each flight in the Requested Flight Plans file, your program will print the three most efficient flight plans available based on whether the request was to order by time or cost.  If there are fewer than three possible plans, output all of the possible plans.  If no flight plan can be created, then an error message should be output. Here is an example:

Flight 1: Dallas, Houston (Time)

Path 1: Dallas -> Houston. Time: 51 Cost: 101.00

Path 2: Dallas -> Austin -> Houston. Time: 86 Cost: 193.00

Flight 2: Chicago, Dallas (Cost)

Path 1: Chicago -> Austin -> Dallas. Time: 237 Cost: 242.00

Path 2: Chicago -> Austin -> Houston -> Dallas. Time: 282 Cost: 340.00

Flight Planning (Traveling Salesman) Problem Implementation in Java:

Dijkstra Priority Queue In java code. file: file: file: file: file:

You must have the following .txt file in your project directory:

  1. flightData.txt
  2. outFile.txt
  3. requestedFlightData.txt

The flightData.txt file will contain flight information as follows.


The outFile.txt is the output directory where the program output will be saved. 

The requestesFlightData.txt file is the query file as user input as follows.


Please feel free to comment. Java projects with source code.

0/Post a Comment/Comments