Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

... I need a code for the findPath() method to Recursively find a path and Mark

ID: 3542285 • Letter: #

Question

...

I need a code for the findPath() method to Recursively find a path and Mark the direction to move in next with (N,E,S,W) and the end poit with "^"


here is my code with the empty findpath Method


import java.io.*;
import java.util.Scanner;

public class TerrainScanner
{
    private double terrain[][];
    char map[][] = new char[10][10];
    
    /**
     * @param in scanner to read from input file
     * @param r  row
     * @param c  column
     * @param sum take sum of rows
     */
    public void scanTerrain(String terrainMap)
        throws IOException
    {
        Scanner in = new Scanner(new BufferedReader(new FileReader(terrainMap)));
        for(int r = 0; r < 10; r++)
        {
            for(int c = 0; c < 10; c++)
            {
                int sum = 0;
                for(int i = 0; i < 6; i++)
                    sum += in.nextInt();

                in.nextLine();
                terrain[r][c] = sum / 6.00;
            }

        }

    }
   
    /**
     * @param in scanner to read from input file
     * @param r  row
     * @param c  column
     */
    public char[][] generateMap(int threshold)
    {
        
        for(int r = 0; r < 10; r++)
        {
            for(int c = 0; c < 10; c++)
            {
                char mark;
                if(terrain[r][c] > (double)threshold)
                {
                    mark = 'X';
                } else
                {
                    mark = ' ';
                    int i = 0;
                    if(r + 1 < 10 && checkIfPassable(r + 1, c, threshold))
                        i++;
                    if(r - 1 >= 0 && checkIfPassable(r - 1, c, threshold))
                        i++;
                    if(c + 1 < 10 && checkIfPassable(r, c + 1, threshold))
                        i++;
                    if(c - 1 >= 0 && checkIfPassable(r, c - 1, threshold))
                        i++;
                    mark = (char)(i + 48);
                }
                map[r][c] = mark;
            }

        }

        return map;
    }

    /**
     * @return  terrain at the current position within selected threshold
     */
    public boolean checkIfPassable(int row, int col, int threshold)
    {
        return terrain[row][col] <= (double)threshold;
    }
     /**
     * @return highest elevations
     */
    public double getHighestElevation()
    {
        double max = terrain[0][0];
        for(int r = 0; r<10; r++){
            for (int c = 0; c<10; c++)
            if(max < terrain[r][c]){
                max = terrain[r][c];
                }
        }
        return max;
    }
    /**
     * @return lowest elevation
     */
    public double getLowestElevation()
    {
         double min = terrain[0][0];
        for(int r = 0; r<10; r++){
            for (int c = 0; c<10; c++)
            if(min > terrain[r][c]){
                min = terrain[r][c];
                }
        }
        return min;
    }
   
    /**
     * @param terrain = 2D array to hold terrain averages
     */
    public TerrainScanner()
    {
        terrain = new double[10][10];
    }
   
    
    public char[][] findPath(int startRow, int startCol, int destRow, int destCol,
            int threshold){
                
        
        
        

        
    }

}  



You have to write a recursive method to find a path from A to B You program should be able to display the path on the map. Each cell on the path should be marked by letter "S"(South) or "N"(North) or 'E'(East) or 'W'(West), which tells people the direction that they should go The destination cell should be marked by "^". You will be given a jar file which makes certain assumptions about the class you create to work with it. It must be contained in a package named "edu.wmch.cs1120Ia2" The class must be named TerrainScanner It must have the following public methods (The method names can not be changed because GUI will call those method by those names You may have other methods as well) public void scenTerain(String input File) throws IOException public char[][] generateMep(int threshold) public boolean checklfPassable(int row, int col, int threshold) public double getHighestElevetion() public double getLowestElevation() public char[][] findpath(int startRow, int start int destRow, int destCol, int threshold)

Explanation / Answer

hhhhh