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
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