Question
I need help writing a JAVA code with these instructions. Thanks! Write a program that can perform the following tasks: 1. Ask user to input
I need help writing a JAVA code with these instructions. Thanks! Write a program that can perform the following tasks: 1. Ask user to input an integer N, which will be the side length of a 2D square board. 2. Create a 1D empty array (with appropriate size) that will later be used to represent the 2D square board. 3. Fill the 1D array with character O. 4. Ask user to enter 2 integer numbers: x-coordinate and y-coordinate. a. These 2 numbers will be entered one at a time (see example in sample output). b. If either of these number is larger than N, or equals to 0, show error message and ask user to re-enter the coordinate. 5. Put a X character at location (x, y) of the 2D board. a. If the corresponding location has already been marked as X. Output message to tell user that location has already been marked. 6. Print out the current 2D board. 7. Repeat from step 4 until user enter -1 at any point.
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