Question: JAVA Create a 2D character array with 5 rows and 5 columns To start, fill every position with an O. Then, fill the [0][0] position

JAVA Create a 2D character array with 5 rows and 5 columns To start, fill every position with an O. Then, fill the [0][0] position with an X. This X represents the user's "avatar". Create a loop which does the following: -Starts by printing the array -Asks the user for what direction they would like to go -Waits for user input -Moves the avatar in that direction, if it exists (ie: up=row-1, right=column+1) -If it does not exist, tell the user and exit the program -Fill the avatar's new position with an X -Fill the avatar's old position with an O Example Output: Current Map: ========= X O O O O O O O O O O O O O O O O O O O O O O O O ========= Which direction would you like to move? >down Current Map: ========= O O O O O X O O O O O O O O O O O O O O O O O O O ========= Which direction would you like to move? >right Current Map: ========= O O O O O O X O O O O O O O O O O O O O O O O O O ========= Which direction would you like to move? >up Current Map: ========= O X O O O O O O O O O O O O O O O O O O O O O O O ========= Which direction would you like to move? >up Error: You cannot move there from your current position Exiting program...

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!