JAVA single class HELP: I need help with a single class (class Haze) in a progra
ID: 3741026 • Letter: J
Question
JAVA single class HELP:
I need help with a single class (class Haze) in a program called "Panic". Please read and help me if you can. Thank you
This project is called Panic! We will describe a single-level floorplan of a building, filled with different kinds of people and different kinds of threats. We will simulate how the people seek to evacuate the building to safety, and how the threats spread throughout the building. Various events will be announced, such as person movements, threats spawning, and people reaching safety or succumbing to the threats. We will read a map representation from a file, and we will write the messages to either a file or just System.out as directed.
Here is the link to an introduction and some sample runs for this program: https://paste.ee/p/AJsg6
--------------------------Task---------------------
class Haze
It has no fields, but has a constructor and overrides a few abstract methods it inherited, in order to be concrete.
Methods
public Haze(Coord c, Map map, PrintStream log). Via the parent constructor, initializes all fields. fullCharge must be set to 2, and again charge starts at 0.
@Override public void spawn(Coord c). Creates a new Haze object and adds it to the map at location c. Do not add a Haze at a location that already has a Hazepresent.When adding a new Haze object to the map, generate a log message of the form
where the location is the position of the new haze.
Note: hazes can't directly kill anyone, so there is nothing extra to add to doAction; rely upon the inherited version.
@Override public boolean canLookThrough(). People can't look through haze.
@Override public boolean canPassThrough(). People can walk through haze. It's scary, though, because there may be slime there! It's a trap!
----------------------Java codes for other classes (used to extend and implement)------------
Please open the link, because they are a little long. Thank you
class Thing: https://paste.ee/p/j6ULE
class Representable:
public interface Representable {
public abstract String repr();
}
class Passible:
public interface Passable {
public abstract boolean canLookThrough();
public abstract boolean canPassThrough();
}
class Coord: https://paste.ee/p/pgUlM
class Threat: https://paste.ee/p/IhsuT
Here is the link to the overview of this program: https://paste.ee/p/LE1l0
Thank you so much.
Explanation / Answer
Please check Haze.java above. Thanks!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.