We can represent ASCII art in a 2D array of rows and columns. What...

Question

# We can represent ASCII art in a 2D array of rows and columns. What...

We can represent ASCII art in a 2D array of rows and columns. What do you think the following code will print out? Try to guess before you run it. The loops to print out the 2D array will be explained in the next lesson. Then, do the following:

Change the code to use 2 assignment statements with the 2D array asciiArt to change the "o" characters to "@" characters. You should figure out what the row and column indices should be for the "o" characters and use them with the array name to set that character to "@". After testing this code, comment it out so that your teacher can still see it.

Add a new asciiArt array with a different ASCII art from the collection or of your own design. Be careful with the special characters like " and \. You will need to put another backslash in front of these to print them out like \" and \\.

Part 1: Add 2 assignment statements for the 2D array asciiArt to change the "o" characters to "@" characters. Part 2: Create a new asciiArt array and print it out.

public class AsciiArt

{

public static void main(String[] args)

{

String[][] asciiArt = {

{" ", " ", "_", "_", "_", " ", " "},

{" ", "(", "o", " ", "o", ")", " "},

{"(", " ", " ", "V", " ", " ", ")"},

{" ", "-", "m", "-", "m", "-", " "},

};

//Part 1: Add 2 assignment statements to change "o" to "@"

// print the asciiArt for Part 1

System.out.println("ASCII Art:");

for(String[] row : asciiArt) {

for(String column : row)

System.out.print(column);

System.out.println();

}

//Part 2: Create your own ASCII art array and print it out!

}

}

Solved by verified expert

sec

sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec ali

10,000 step-by-step explanations

sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, con

## Step-by-step explanation

sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesq

``sectetur adipiscing elit. Nam lacinia pulvi``

``sectetur adipiscing elit.``

sectetur adipiscing elit. Nam lacinia pulvi

``sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molesti``

sectetur a

``sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. F``