Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSE 1 3 2 2 L Lab 1 Background: In this lab, you are going to draw some Ascii Art using a two dimensional array.
CSEL Lab
Background:
In this lab, you are going to draw some Ascii Art using a two dimensional array. When dealing with
multidimensional arrays, youll typically use nested loops ie a loop within a loop The outer loop
typically iterates over the rows of the array, while the inner loop typically iterates over the columns.
A two dimensional array uses two indexes. The first index represents the row number, while the
second index represents the column. For example: myArray refers to the first row and the
second column
Your Tasks:
Open your IDE and start a new project.
Copy and paste the appropriate version of the makeforward method from page below. This
method creates and returns a two dimensional array of characters with some Ascii Art in it
In your main method, create a two dimensional array of characters with rows and columns.
Call the makeforward method and store the result in your new array.
Using loops, print out the array contents character by character. You should see Ascii Art.
Write a new method called makemirror It should take a two dimensional array as a
parameter and return a mirrored version of that D array. ie The contents of each row should
be reversed as follows:
a Input array cell should be copied to cell in the return array, likewise cell
should be copied to cell cell should be copied to cell
b Cell will be copied to cell cell should be copied to cell etc...
c The same is true for the other two rows.
d As you copy each character, check the table below to see if the character itself needs to
be reversed. If the character is not in the table, copy it as normal, but if it is in the table,
replace it with the Mirrored character. You will need if statements for this.
Old Character
backslash above enter key
Mirrored Character
backslash above enter key
Note: The backslash has special meaning. It means to escape the next character thats typed. For
example, if you want to set a variable x to you would write: char x This is because quotes
are used when specifying a character. If you wish to print or compare a backslash itself, youll need to
escape it so youll actually have to write So for example, to set a variable x to youd write
char x Youll need this when swapping forward slashes and backslashes. There are examples
of escaping in the provided makeforward method.
Old Character Mirrored Character
backslash above enter key
backslash above enter key
In your main method, create another d array of characters of the same size x Call the
makemirror method, passing it the original array returned from the makeforward method.
Store the result in your new array.
Print out the mirrored D array.
Finally, in your main method, print the forward and mirrored image on the same lines, so that
they face each other as if having a head on collision...see below:
Page :
public static char makeforward
char pixel new char;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
pixel;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started