Question: Can you please explain the code also? thanks. TASK: Create a class called CharGrid that has the following properties: It should have one private instance

Can you please explain the code also? thanks. TASK: Create a classCan you please explain the code also? thanks.

TASK: Create a class called CharGrid that has the following properties: It should have one private instance variable of type char[][] called grid It should have a public constructor that has two int parameters numRows and numCols, which should set the grid instance variable to a char[numRows] (numCols) filled with asterisks (i.e., *) It should have a public constructor that has two int parameters numRows and numCols followed by one char parameter symbol, which should set the grid instance variable to a char[numRows] [numCols] filled with symbol It should override the toString method such that it returns a multi-line String with the symbols in each row on its own line EXAMPLE: If I run the following lines of code: CharGrid myGrid = new CharGrid(3, 10); String myString = myGrid.toString(); Then myString would be the following String: ********** ********** ********** Sample Input: 3 10 Sample Output: ********** ********** **********

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!