Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this exercise, you will create a full 8x8 chess board. First, initialize an 8x8 2D String array. Then, populate the first and last array

In this exercise, you will create a full 8x8 chess board.

First, initialize an 8x8 2D String array. Then, populate the first and last array in the 2D array with the correct chess pieces. The rest of the arrays should be filled with Strings with the value "-".

When printed using the provided method, the result should look like:

Rook Knight Bishop Queen King Bishop Knight Rook - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Rook Knight Bishop King Queen Bishop Knight Rook 

public class ChessBoard { public static void main(String[] args) { //Create an 8x8 2D String array called chess. //Use this method to print the chess board onto the console print(chess); } //Do not make alterations to this method! public static void print(String[][] array) { for(String[] row: array) { for(String thing: row) { if(thing == "-") { System.out.print(" "+ thing +" "); } else { System.out.print(thing + " "); } } System.out.println(); } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions