Question: CAN SOMEONE SOLVE THE ERRORS IN THIS CODE PLEASE? AND UPLOAD IT AGAIN..SOLVED? import java.util.Scanner; public class leafpile { public static void main(String[] args) {
CAN SOMEONE SOLVE THE ERRORS IN THIS CODE PLEASE? AND UPLOAD IT AGAIN..SOLVED?
import java.util.Scanner;
public class leafpile { public static void main(String[] args) { Ground map[][] = new Ground[5][10]; generateRandomGround(map); printMap(map); System.out.println(largestLeafPile(map)); }
/***************** STUDENT CODE HERE *******************/
private static int largestLeafPile(Ground map[][]) { static int cnt; static int vis[][] = new int[1000][1000]; static void dfs(int a[][],int x,int y) { vis[x][y] = 1; if(x+1
/**************** END STUDENT CODE **********************/
/************ Utility Methods *************/
private static void printMap(Ground map[][]) { for (int r = 0; r < map.length; r++) { for (int c = 0; c < map[r].length; c++) { if (map[r][c] == Ground.GRASS) { System.out.print(". "); } if (map[r][c] == Ground.LEAF) { System.out.print("~ "); } } System.out.println(); } }
private static void generateRandomGround(Ground map[][]) { int randGround; for (int r = 0; r < map.length; r++) { for (int c = 0; c < map[r].length; c++) { randGround = (int) (Math.random() * 2); map[r][c] = randGround == 0 ? Ground.GRASS : Ground.LEAF; } } }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
