Question: Welcome to your first assignment The problem statement in the assignment is long, but that's because the question specifies the requirements in detail. Develop the




Welcome to your first assignment The problem statement in the assignment is long, but that's because the question specifies the requirements in detail. Develop the program class-by-class, and module-by-module in a step-wise fashion, including tests at every stage. Most board games have pieces that move across the board with certain set rules about how far and in which direction they may move. In this assignment, you will set up the infrastructure for a board game and demonstrate its operation. Start by defining an abstract a class called Piece with the following fields that describe the piece Name: A String (such as Jedi, Droid, etc.) .Colour: Another String (such as Black, Red, Green, Blue, etc.) Position: Assume that the games for which a piece may be used are played on 8 X 8 boards - the position is a coordinate (i, j) on such a board, with each coordinate taking on a value between 0 and 7. (The top left corner of the board is taken to be the origin (0,0).) You can define (x,y) position in a separate class Implement: A constructor that creates a Piece object with the given name, colour and position Appropriate get and set methods * toString method to display the object's attributes A SlowPiece is a piece that moves left or right exactly one step in every move. Define a class called SlowPiece that extends Piece, implementing a constructor and redefining the inherited toString method. In addition, implement A method move (String direction) to move the piece left or right by one space. This method ill accept a direction parameter. If the move is requested that would take the piece off the edge of the board, simply return without doing anything . A FastPiece is a piece that can move left or right as many steps as specified. Define a class called FastPiece that extends Piece, implementing a constructor and redefining the inherited toString method. In addition, implement A method move(String direction, int n) to move the piece left or right by as many spaces as needed. This method will accept a direction parameter and the number of spaces. As before, if a move is requested that would take the piece off the edge of the board, simply return without doing anything A FlexiblePiece is one that can move right or left as well as up or down - this leads to slow flexible and fast flexible pieces. Extend the class hierarchy developed so far to include these two new kinds of pieces. Class SlowFlexible extends SlowPiece and class FastFlexible extends FastPiece. Define methods in these classes as needed. Welcome to your first assignment The problem statement in the assignment is long, but that's because the question specifies the requirements in detail. Develop the program class-by-class, and module-by-module in a step-wise fashion, including tests at every stage. Most board games have pieces that move across the board with certain set rules about how far and in which direction they may move. In this assignment, you will set up the infrastructure for a board game and demonstrate its operation. Start by defining an abstract a class called Piece with the following fields that describe the piece Name: A String (such as Jedi, Droid, etc.) .Colour: Another String (such as Black, Red, Green, Blue, etc.) Position: Assume that the games for which a piece may be used are played on 8 X 8 boards - the position is a coordinate (i, j) on such a board, with each coordinate taking on a value between 0 and 7. (The top left corner of the board is taken to be the origin (0,0).) You can define (x,y) position in a separate class Implement: A constructor that creates a Piece object with the given name, colour and position Appropriate get and set methods * toString method to display the object's attributes A SlowPiece is a piece that moves left or right exactly one step in every move. Define a class called SlowPiece that extends Piece, implementing a constructor and redefining the inherited toString method. In addition, implement A method move (String direction) to move the piece left or right by one space. This method ill accept a direction parameter. If the move is requested that would take the piece off the edge of the board, simply return without doing anything . A FastPiece is a piece that can move left or right as many steps as specified. Define a class called FastPiece that extends Piece, implementing a constructor and redefining the inherited toString method. In addition, implement A method move(String direction, int n) to move the piece left or right by as many spaces as needed. This method will accept a direction parameter and the number of spaces. As before, if a move is requested that would take the piece off the edge of the board, simply return without doing anything A FlexiblePiece is one that can move right or left as well as up or down - this leads to slow flexible and fast flexible pieces. Extend the class hierarchy developed so far to include these two new kinds of pieces. Class SlowFlexible extends SlowPiece and class FastFlexible extends FastPiece. Define methods in these classes as needed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
