Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help implementing this Java class Randomly moves around according to the cy

ID: 3825771 • Letter: N

Question

Need help implementing this Java class

Randomly moves around according to the cycle of food. A "D" in a map file.

A subtype of Food that shall walk! Whenever the dungeoness crab's timer resets, it shall look for a randomly open cell. If one exists, it shall move to that cell. We shall represent crabs with a 'D'.

Method Summary

Updates the cell based off of the state.

Get the character representation for this State.

Methods inherited from class hw4.Food

getColor, isPassable

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

DungeonessCrab

Method Detail

handle

Description copied from interface: State

Updates the cell based off of the state. This method can update the cell's state, or potentially another cell's state depending on the implementation.

Specified by:

handle in interface State

Overrides:

handle in class Food

Parameters:

cell - The cell that this state belongs to

toChar

Description copied from interface: State

Get the character representation for this State. Used for loading map text files.

Specified by:

toChar in interface State

Overrides:

toChar in class Food

Returns:

character representation for this State

All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description void handle(Cell cell)

Updates the cell based off of the state.

char toChar()

Get the character representation for this State.

Explanation / Answer

//Working on it Updaint soon

Randomly moves around according to the cycle of food. A "D" in a map file.

A subtype of Food that shall walk! Whenever the dungeoness crab's timer resets, it shall look for a randomly open cell. If one exists, it shall move to that cell. We shall represent crabs with a 'D'.

Method Summary

Updates the cell based off of the state.

Get the character representation for this State.

Methods inherited from class hw4.Food

getColor, isPassable

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

DungeonessCrab

Method Detail

handle

Description copied from interface: State

Updates the cell based off of the state. This method can update the cell's state, or potentially another cell's state depending on the implementation.

Specified by:

handle in interface State

Overrides:

handle in class Food

Parameters:

cell - The cell that this state belongs to

toChar

Description copied from interface: State

Get the character representation for this State. Used for loading map text files.

Specified by:

toChar in interface State

Overrides:

toChar in class Food

Returns:

character representation for this State

All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description void handle(Cell cell)

Updates the cell based off of the state.

char toChar()

Get the character representation for this State.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote