Question: In Java Youll create 3 classes Board Square Piece Board Class: Design Board owns the squares. The board will create and manage the squares. The

In Java

Youll create 3 classes

Board

Square Piece

Board Class:

Design Board owns the squares. The board will create and manage the squares. The squares will contain, but wont exclusively own the Pieces. But theyll be our holders. Pieces for now will be very simple a name and 1 function. See functions below.

Board

Variables:

Squares

Functions:

SetPieceOnSpace

Takes a piece as input

Sets the piece on given coordinates

RemovePieceFromSpace

Takes coordinates as input

Removes the piece at those coordinates and places an Empty piece now

Constructor

Sets the board by default for every board we create

Square

Variables:

Piece

Functions:

GetPiece

Returns the piece on the square

SetPiece

Sets a piece on the square

Takes a piece as input

Constructor

Generic constructor

Specific constructor Piece

Points

Variables

Name

Color

Functions:

Move

As long as the piece move to the coordinates specified youve meet the criteria.

Objective: youll setup the board, display it, and ask the user to type a piece name, enter coordinates to move that piece. Remove the piece from its original position, replacing it with an empty, and placing it on the new square. Youll then print the board, and ask the user if theyd like to keep going or quit.

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!