Question: write a java code a) Code a definition for a class named ChessPiece. Its (public) attributes are: The name of the piece Its position on
write a java code
a) Code a definition for a class named ChessPiece. Its (public) attributes are: The name of the piece Its position on the chess board b) Code a definition for a class named ChessBoard that represents a chess board. Its attributes are: the height of the board in number of tiles (m tiles) - private attribute the width of the board in number of tiles (n tiles) - private attribute a 2D array of type ChessPiece[][] of m rows by n columns - private attribute public attributes of type ChessPiece, one for each type of piece on the chess board: the pawn, the king, the queen, the bishop, the knight, the rook. The value of each piece is the name of the piece. c) For the ChessBoard class, code a constructor that takes values to initialize these attributes. d) For the ChessBoard class, code 3 getters, one for each attribute that is not a chess piece. e) For the ChessBoard class, code 3 setters, one for each attribute that is not a chess piece. f) How could encapsulation be improved in this program? No code needed here; just answer the question. g) How could coupling be reduced in this program? No code needed here; just answer the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
