Complete the weekly labs based on the following:
- Write the code for each lab assignment.
- The lab is to be submitted in a single zip file in the online course shell, which must contain all .java files, along with any additional files that may be necessary for your project to run (ex: text files).
- Any and all written answers must be entered into the online course shell with the submission of the attached lab assignment.
Each lab assignment will be graded based on the following:
- The program must compile, execute, produce correct results, and meet all of the specifications in the weekly lab. Additionally, you must
- Organize the code for user readability.
- Organize the code for reusability.
- Provide documentation with embedded comments for reader understanding.
- Organize the code for efficiency.
15. We want to count the number of possible paths to move from row 1, column 1 to row N, column N in a two-dimensional grid. Steps are restricted to going up or to the right, but not diagonally. The illustration shows three of many paths, if N = 10:
a. The following method, numPaths, is supposed to count the number of paths, but it has some problems. Debug the method.
int numPaths(int row, int col, int n)
{
if (row = = n)
return 1;
else
if (col = = n)
return (numPaths + 1);
else
return (numPaths(row + 1, col) * numPaths(row, col + 1))