Question: Java Programming : import java.util.Random; import java.util.Scanner; public class TrackCarver { public static void main ( String [ ] args ) { / / TODO
Java Programming : import java.util.Random;
import java.util.Scanner;
public class TrackCarver
public static void mainString args
TODO Autogenerated method stub
Scanner kb new ScannerSystemin;
System.out.printlnHow high would you like the track to beEven numbers will be converted to odd;
int y kbnextInt;
System.out.printlnHow width would you like the track to beEven numbers will be converted to odd;
int x kbnextInt;
Make sure the sizes are not negative
y Math.absy;
x Math.absx;
and make sure they are odd values
ify
y;
ifx
x;
Create the grid
char grid new charxy;
TrackGenerator.generateMazegrid;
Print the grid to a textfile or to print to screen
TrackGenerator.printMatrixgrid"track";
System.out.printlnDone;
import java.ioFile;
import java.ioPrintWriter;
import java.util.Random;
public class TrackGenerator
private static Random rand new Random;
private static void fillDArraychar wood
Fill the D array 'wood' with nonspace characters
TODO FILL IN CODE HERE
private static void carveTrackchar wood, int x int y
TODO FILL IN CODE HERE
private static boolean hasWestNeighborchar wood, int x int y
return x && woodxy;
private static boolean hasEastNeighborchar wood, int x int y
return x && woodxy;
private static boolean hasSouthNeighborchar wood, int x int y
return y
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
