Question
Create this enum in JAVA enum Spot implements Representable, Passable enum Spot implements Representable and Passable interfaces. (what methods will Spot have to implement as
Create this enum in JAVA
enum Spot implements Representable, Passable
enum Spot implements Representable and Passable interfaces. (what methods will Spot have to implement as a consequence?) Spots represent the permanent walls, spaces, and signage at a particular coordinate on a Map. Other things may be also present at a coordinate or not during the simulation, but the Spot is the actual wall, open spot, exit (also open in a sense), or sign (an open spot with an exit sign).
Values
Open, Wall, Exit, SignN, SignE, SignS, SignW.
Fields
You can add whatever fields you'd like beyond String repr in order to complete the required methods. If you do, they must either be private or be public final. It may be useful to use the following: boolean lookThrough, boolean passThrough, Direction dir.
public final String repr. Representation of the spot. The correct characters must be used (see Map Representations).
Methods
Spot( ??? ). Constructor, intializes any fields you have. Luckily for testing purposes, we don't get to create extra values of your enumeration type, so it doesn't matter what exact signature your constructor has as long as the methods below are provided as expected.
Manual Inspection Criteria (5%) : your constructor correctly initializes any and all fields your Spot enumeration contains.
public boolean isSign(). Determines if the spot is one of our four SignX spot values.
@Override public String toString(). Uses the repr value as its result.
@Override public String repr(). Uses the repr value as its result.
@Override public boolean canLookThrough(). Answers if a person is able to look beyond this spot. It is true for all spots except Wall.
@Override public boolean canPassThrough(). Answers if a person is able to walk into/through this spot. It is true for all spots except Wall.
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