Question: java please... The mouse is depicted by the @ character, the cheese by % characters, and the otherwise empty vs wall-occupied locations in the room

java please...

The mouse is depicted by the @ character, the cheese by % characters, and the otherwise empty vs wall-occupied locations in the room are depicted by . and # characters respectively. The position of each piece of cheese will be stored in an int array. The x-positions which increase from left (0) to right (19) should be stored at index zero within these arrays. And the y-positions which increase from top (0) to bottom (9) should be stored at index one within these arrays.

Implement and call the following method to help visualize the randomly positioned contents of our room:

1

public static void printRoom(char[][] room, int[][] cheesePositions, int mouseX, int mouseY) {}

The priorities that these objects should be displayed (in case they are ever in the same positions) is that the mouse should always appear in its specified position, cheese pieces should have the second highest priority, and in positions that contain neither mouse nor cheese, you should display whatever character is stored in room for that position (usually hashtags and periods, but should work for any other characters that might be stored in there as well). Each row of room contents should be displayed on a separate line, so that the result appears similar to the example at the top of this write-up.

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!