Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overview: In this project you will use Dijkstra's algorithm to find route information between two airports chosen by the user. The user will be shown

Overview: In this project you will use Dijkstra's algorithm to find route information between two airports chosen by the user. The user will be shown a route that results in the lowest price. Details: Write a Java program that lets the user choose two airports and finds the route that has the least price. Your program should read the airports.txt file that is posted, or any file having the same format. It should then prompt the user to enter two airports. Dijkstra's algorithm should be run to find the cheapest route. The price, number of connections, and actual route should be shown. The user should be able to continue checking routes until no more routes are requested. You are expected to write Dijkstra's algorithm yourself following the pseudocode found in both the slides and in the textbook. You can use the Vertex class and printPath found in the textbook if you wish. You may not use code for Dijkstra's algorithm found from other sources. Your output should match the sample output below: Sample output: Enter departure airport: DFW Enter arrival airport: SFO By price: Price: 1100 Connections: 1 Route: DFW -> LAX -> SFO Check another route (Y/N)? 

Airports.txt

ATL BOS 250 DFW 250 MOB 59 AUS DFW 59 HOU 59 SAT 59 BOS ATL 250 DFW 250 DFW ATL 250 AUS 59 BOS 250 HOU 128 LAX 1000 LIT 59 MSY 128 OKC 59 SHV 59 SFO 1200 HOU AUS 59 DFW 128 SAT 59 LAX DFW 1000 SFO 100 LIT DFW 59 MOB ATL 59 MSY DFW 128 OKC DFW 59 SAT AUS 59 HOU 59 SFO DFW 1200 LAX 100 SHV DFW 59 

Thanks in advance!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions