Question: } / / Getter method for distance public int getDistance ( ) { if ( distance = = - 1 ) { / / Ensure
Getter method for distance
public int getDistance
if distance Ensure distance is calculated if not already done
distance findDistancestartWord endWord;
return distance;
Getter method for the path
public String getPath
if distance Ensure distance is calculated before finding path
distance findDistancestartWord endWord;
if distance
return "There is no path";
if pathisEmpty Calculate the path if it hasn't been done yet
findPathstartWord endWord;
return String.join path;
this is the last part of the LevenshteinFinder.java code, for some reason this code its not quite working. It should see something like what is below, but for me after i enter both words i keep getting the error, Error: getDistance has not been run yet. and i dont know why, can i get help and its okay if you need to modify the code but cant modify the main method only the finder, the main one can only have very tiny changes.
Welcome to the Levenshtein Edit distance solver
Please type in two words of the same size that will be used
To find a path between them.
What word would you like to start with?
Witch
What word would you like to end with?
Coven
The distance between your words is
The path between your words is : witchwatchmatchmarchmarcs
maresmoresmovescovescoven
Total execution time: ms
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
