Write a method called prettyOutput for the maze where you output it in a format that is easier to visualize. For this, print a border around the table, like a + in each corner, a row of minuses above and below the table, and a | at the beginning and at the end of each row. Then when you print the elements, check if the value is equal to 0, and if it is, print a couple of spaces, if it's equal to 1, then print a * character followed by a space, and if it's equal to 2, print a period (.) followed by a space. How do I add the bolded part in the method, please see what I have so far below: public void prettyOutput() { System.out.print("+"); for (int i=0; i <= columns*2; ++i) { System.out.print("-"); } System.out.println("+"); for (int r=0; r < maze.length; ++r){ System.out.print("| "); for (int c=0; c < maze[r].length; ++c) { System.out.printf(maze[r][c]+" "); } System.out.println("|"); } System.out.print("+"); for (int i=0; i <= columns*2; ++i){ System.out.print("-"); } System.out.println("+"); } Subject: Java Programming
Write a method called prettyOutput for the maze where you output it in a format that is easier to
visualize. For this, print a border around the table, like a + in each corner, a row of minuses above and below
the table, and a | at the beginning and at the end of each row. Then when you print the elements, check if the
value is equal to 0, and if it is, print a couple of spaces, if it's equal to 1, then print a * character followed by a
space, and if it's equal to 2, print a period (.) followed by a space.
How do I add the bolded part in the method, please see what I have so far below:
public void prettyOutput()
{
System.out.print("+");
for (int i=0; i <= columns*2; ++i)
{
System.out.print("-");
}
System.out.println("+");
for (int r=0; r < maze.length; ++r){
System.out.print("| ");
for (int c=0; c < maze[r].length; ++c)
{
System.out.printf(maze[r][c]+" ");
}
System.out.println("|");
}
System.out.print("+");
for (int i=0; i <= columns*2; ++i){
System.out.print("-");
}
System.out.println("+");
}
Subject: Java Programming
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)