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

Language: Processing. Write an active processing Sketch that that draws some num

ID: 662769 • Letter: L

Question

Language: Processing.

Write an active processing Sketch that that draws some number of rectangles on the screen (nicely spaced and making a rows across the screen). Use global variables called numCols and numRows to define the number of rows and columns. (There will be numRows x numCols rectangles in total.)
Each rectangle will be one of two different colours: some dark colour if the mouse is not over it and some bright colour if the mouse is over it.
Each rectangle will display a number inside it. The number must be easily read (no matter what colour it is) and the number will be the number of times that the mouse has been clicked on this rectangle. For each rectangle, the numbers will start at zero, then go to one, then two, then three and then start over at zero (and repeat) with mouse clicks.
Submit your sketch with numCols set to 3 and numRows set to 2. If you cannot get it working with arrays, you can submit your sketch with a single box exhibiting the same behaviour for style marks and 2/6 correctness marks.

Your program might look something like:

3 5 0

Explanation / Answer

// 2D Array of objects Cell[][] grid; // Number of columns and rows in the grid int cols = 3; int rows = 2; void setup() { size(200,200); grid = new Cell[cols][rows]; for (int i = 0; i