Question: Phase 1: The board First, implement the abstract class Tile. This class represents the elements of the two-dimensional array that is the board (a Tile[][]

Phase 1: The board First, implement the abstract class Tile. This class represents the elements of the two-dimensional array that is the board (a Tile[][] array). The tiles will hold the game pieces or a wall. We will add more to this class later. To start, a Tile should have: Two instance variables: a String which is the symbol that should be displayed by this tile,and a boolean which will indicate if this tile is a tile that the player can move onto (is passable). A constructor that has two parameters the String and the boolean, in that order. Method String getSymbol()which fetches the symbol that should be displayed. Method boolean isPassable() which indicates if the tile is passable.

Now implement two subclasses of the Tile class: Wall, and OpenSpace.

Class Wall is not passable, and the symbol is a hash:#

Class OpenSpace is an empty space which is passable, and the symbol is a period: .

These subclasses will only contain constructors. All the other logic in them is inherited from class Tile.

You can test your classes using the supplied test program TestPhase1.java. You should get the output shown below. ####

#..#

#..#

####

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!