Question: Create a method: public MazePoint[][] readfile(String fileName) This method reads the maze file and turns it into a 2D array of MazePoint objects. The input
Create a method: public MazePoint[][] readfile(String fileName)
This method reads the maze file and turns it into a 2D array of MazePoint objects. The input fileName is the filename of the maze you want to read. (use Scanner to read in the input file).
The input file contains the information of an input maze.
-
The first line will represent the number of rows in the maze, while the second represents the number of columns. These numbers will not always be equal but always be positive.
-
Between every column, there will be a single space. Every row is separated with ' ' (a new-line character).
-
There are no leftover blank lines in the input file (i.e. no trailing whitespace). There are no extra spaces between rows or between columns. There are no extra spaces before nor after each line.
Read the input file, convert the input file into a 2D array, and close the Scanner for the input file at the end.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
