Task 3: Implement method setup in PE1 class. The description of what is wanted is given in the starter code.   public class PE1 { MazedogMaze;  /** * This method sets up the maze using the given input argument * @param maze is a maze that is used to construct the dogMaze */     publicvoidsetup(String[][]maze){ /* insert your code here to create the dogMaze  * using the input argument.  */   }     /** * This method returns true if the number of  * gates in dogMaze >= 2.  * @return it returns true, if enough gate exists (at least 2), otherwise false. */ publicbooleanenoughGate(){ // insert your code here. Change the return value to fit your purpose.        returntrue; }   /** * This method finds a path from the entrance gate to  * the exit gate.  * @param row is the index of the row, where the entrance is. * @param column is the index of the column, where the entrance is. * @return it returns a string that contains the path from the start to the end.  * The return value should have a pattern like this (i,j)(k,l),... * The first pair of the output must show the entrance given as the  * input parameter (i.e. (row,column) * No whitespace is allowed in the output.   */ publicStringfindPath(introw,intcolumn){ // insert your code here. Change the return value to fit your purpose.    }     /**  * This class defines a maze using a 2D array.   * To complete the code, you should not change the method   * signatures (header).   *  */   class Maze{ privateString[][]maze;    /** * This constructor makes the maze.  * @param maze is a 2D array that contains information  * on how each cell of the array looks like.  */ publicMaze(String[][]maze){ /*complete the constructor so that the maze is  * a deep copy of the input parameter.  */ String[][]mazeArray={ {1100,1000,1010,1010,1001,1100,1000,1001,1100,1001}, {0101,0110,1010,1001,0101,0101,0111,0101,0101,0101}, {0101,1110,1001,0101,0111,0110,1001,0101,0111,0101}, {0101,1100,0011,0101,1100,1010,0011,0101,1100,0010}, {0100,0011,1100,0011,0101,1100,1001,0101,0110,1001}, {0100,1001,0100,1001,0110,0011,0101,0110,1010,0011}, {0101,0101,0101,0100,1000,1000,0011,1110,1010,1001}, {0101,0111,0101,0101,0111,0100,1000,1000,1011,0101}, {0111,1100,0011,0110,1001,0101,0111,0110,1010,0011}, {1001,0111,1100,1010,0011,0110,1010,1010,1010,1001}, {0110,1000,0001,1100,1010,1001,1100,1001,1101,0101}, {1101,0101,0101,0110,1011,0110,0011,0101,0101,0101}, {0110,0001,0110,1001,1100,1001,1100,0011,0110,0001}, {1101,0110,1001,0110,0011,0110,0011,1100,1010,0001}, {0110,1010,0011,1110,1010,1010,1010,0011,1110,0011}};   this.maze=newString[maze.length][]; for(inti=0;i

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
  1. Task 3:

    Implement method setup in PE1 class. The description of what is wanted is given in the starter code.

 

public class PE1 {

MazedogMaze; 

/**

* This method sets up the maze using the given input argument

* @param maze is a maze that is used to construct the dogMaze

*/

 

 

publicvoidsetup(String[][]maze){

/* insert your code here to create the dogMaze 

* using the input argument. 

*/

 

}

 

 

/**

* This method returns true if the number of 

* gates in dogMaze >= 2. 

* @return it returns true, if enough gate exists (at least 2), otherwise false.

*/

publicbooleanenoughGate(){

// insert your code here. Change the return value to fit your purpose. 

 

 

 

returntrue;

}

 

/**

* This method finds a path from the entrance gate to 

* the exit gate. 

* @param row is the index of the row, where the entrance is.

* @param column is the index of the column, where the entrance is.

* @return it returns a string that contains the path from the start to the end. 

* The return value should have a pattern like this (i,j)(k,l),...

* The first pair of the output must show the entrance given as the 

* input parameter (i.e. (row,column)

* No whitespace is allowed in the output.  

*/

publicStringfindPath(introw,intcolumn){

// insert your code here. Change the return value to fit your purpose. 

 

}

 

 

/**

 * This class defines a <code> maze </code> using a 2D array. 

 * To complete the code, you should not change the method 

 * signatures (header). 

 *

 */

 

class Maze{

privateString[][]maze; 

 

/**

* This constructor makes the maze. 

* @param maze is a 2D array that contains information 

* on how each cell of the array looks like. 

*/

publicMaze(String[][]maze){

/*complete the constructor so that the maze is 

* a deep copy of the input parameter. 

*/

String[][]mazeArray={

{1100,1000,1010,1010,1001,1100,1000,1001,1100,1001},

{0101,0110,1010,1001,0101,0101,0111,0101,0101,0101},

{0101,1110,1001,0101,0111,0110,1001,0101,0111,0101},

{0101,1100,0011,0101,1100,1010,0011,0101,1100,0010},

{0100,0011,1100,0011,0101,1100,1001,0101,0110,1001},

{0100,1001,0100,1001,0110,0011,0101,0110,1010,0011},

{0101,0101,0101,0100,1000,1000,0011,1110,1010,1001},

{0101,0111,0101,0101,0111,0100,1000,1000,1011,0101},

{0111,1100,0011,0110,1001,0101,0111,0110,1010,0011},

{1001,0111,1100,1010,0011,0110,1010,1010,1010,1001},

{0110,1000,0001,1100,1010,1001,1100,1001,1101,0101},

{1101,0101,0101,0110,1011,0110,0011,0101,0101,0101},

{0110,0001,0110,1001,1100,1001,1100,0011,0110,0001},

{1101,0110,1001,0110,0011,0110,0011,1100,1010,0001},

{0110,1010,0011,1110,1010,1010,1010,0011,1110,0011}};

 

this.maze=newString[maze.length][];

for(inti=0;i<maze.length;i++){

this.maze[i]=newString[maze[i].length];

for(intj=0;j<maze[i].length;j++){

this.maze[i][j]=maze[i][j];

 

 

 

            }

        }

}

 

 

publicMaze(){

// TODO Auto-generated constructor stub

//this.maze = new String[0][];

}

 

/**

* This accessor (getter) method returns a 2D array that

* represents the maze

* @return it returns a reference to the maze

*/

publicString[][]getMaze(){

/* complete this method providing that a clone of 

* the maze should be returned. 

* you may want to change the return value to fit your purpose.

*/

 

 

String[][]maze=newString[this.maze.length][];

 

for(inti=0;i<maze.length;i++){

 

maze[i]=newString[this.maze[i].length];

 

for(intj=0;j<maze[i].length;j++){

maze[i][j]=this.maze[i][j];

}

}

 

returnmaze;

 

}

 

 

@Override 

publicStringtoString(){

//insert your code here. Change the return value to fit your purpose. 

Stringoutput="";

 

for(inti=0;i<maze.length;i++){

 

output+="[";

 

for(intj=0;j<maze[i].length;j++){

if(j!=0)

output+=" ";

output+=maze[i][j];

}

 

output+="]";

if(i!=maze.length-1)

output+="\n";

}

returnoutput;

}

 

}// end of class Maze

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY