Where are the distance values you want printed?
Is this what is printed and where you want the distances included:
return shortestPath[i].path;
When you build the contents of path, you...
Type: Posts; User: Norm
Where are the distance values you want printed?
Is this what is printed and where you want the distances included:
return shortestPath[i].path;
When you build the contents of path, you...
Where are the distance values kept? Where is the printing of the cities done?
Can the location in the code that builds the String with the cities, access the distances and include them with the...
Yes it would do exactly the same. I don't think I said to print the path because it was already being printed. Leave off the .path and just print the element which will cause the toString() method...
That change was for use when debugging the program. You need to change the code so it calls the toString method and prints out what is returned.
For example print the value of the shortestPath...
Start by changing this:
//public String toString(){
//return place + " " +weight;
//}
to this:
public String toString(){
return "<"+place + " " +weight + ">";
}
Change what is saved in the NodeData class to include what you want to see printed.
For debugging add a toString() method to NodeData that will return useful info to print out.
Where are those distance values available so you can use them when formatting the String for printing?
Can you post what the program prints now and add some comments to it showing what the problem is
and show what you want the output to look like.
Do you have a design or algorithm for solving this problem? Given that, someone could help you fix your code so that it follows the algorithm.
Where do you print the city names? Where is the...