Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The below program is functional however, the getCheapestPath is not returning the true cheapest path, can you fix that and also implement a readFromFile method

The below program is functional however, the getCheapestPath is not returning the true cheapest path, can you fix that and also implement a readFromFile method which reads a .txt file and creates a weighted directed graph from it. The txt file will be of the form:

map.txt

city 1 Tokyo

city 2 New_York

city 3 Honk_Kong

road 1 2 30

road 1 3 15

road 3 2 8

The program should be anble to be implemented as follows in the terminal:

javac Driver.java

java Driver fromCity toCity

Where it then prints out the Cheapest path and distance.

I was unable to fit the source code here because chegg wouldn't allow it, however here is a dl link to a .txt with all the source code.

https://file.town/download/keb4z4guge84y41ihtmvbuzkv

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 Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions