Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a map using java. The ‘toString’ method should return the layout. The map

ID: 3572443 • Letter: C

Question

Create a map using java.

The ‘toString’ method should return the layout.

The map scale should be one unit per cell.

The driver should demonstrate the class by populating an instance with Meta data and occupied spaces. The map (archived via the toString) should be displayed for several different room layouts.

Example:

Room: 162 Floor: 1

X

_

_

_

_

_

_

_

X

_

_

_

_

_

_

_

X

X

X

_

_

X

X

X

_

_

_

_

_

_

_

_

X

X

X

_

_

X

X

X

_

_

_

_

_

_

_

_

X

X

X

_

_

X

X

X

_

_

_

_

_

_

_

_

_

_

_

_

_

X

X

X

_

_

_

_

_

_

_

_

(Any help you can give is appreciated. Will give credit for partial answer.)

X

_

_

_

_

_

_

_

X

_

_

_

_

_

_

_

X

X

X

_

_

X

X

X

_

_

_

_

_

_

_

_

X

X

X

_

_

X

X

X

_

_

_

_

_

_

_

_

X

X

X

_

_

X

X

X

_

_

_

_

_

_

_

_

_

_

_

_

_

X

X

X

_

_

_

_

_

_

_

_

Explanation / Answer

   @Override
   public String toString(){
       String layout = "";
       for(int i=0; i<row; i++){
           for(int j=0;j<column; j++){
               layout +=map[i][j]+" ";
           }
           layout+=" ";
       }
       return layout;
   }
   int row = 20, column = 30;//Size of the rooms in a floor, rows and columns
   char[][] map =new char[row][column];
   //layout that describes the map shown in your example. row[1][2]=X if there is a room else -

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote