Question: Can you please write the code using java - Create Board: This method will create the multi-dimensional array and initialize the values to zeros, such

Can you please write the code using java

Can you please write the code using java - Create Board: This

- Create Board: This method will create the multi-dimensional array and initialize the values to zeros, such as this; 000000000000000000000000000000000000000000000000000000000000etc - Place Ship: This method will accept as parameters the starting coordinates of the ship, the type, and the direction. (vertical or horizontal) Then it will place the ship on the board by updating the array values to be dash characters, such as this " - " The ships: - One Battleship of length 8 - One destroyer of length 2 - Two cruisers of length 4 each - Print Board: This method will output the contents of the board. Where there are ships, the dash character will be printed, where there are no ships, the zero character will be printed. - Fire: This method will accept two coordinates from the user. If there is a ship at that location, it will update the value to X for a hit. If there is no ship, it will update the character to "?" for miss. - A few exception cases to watch for: - If a ship starting coordinate is placed too close to the edge of the array, it will not fil (it would run off the end of the board) - Ships should not collide / overlap

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!