I need help with this Java program over a Rat class program shown below detailed on the given image: package classPackage;   import interfaces.RatInterface; import interfaces.CellInterface; import java.util.ArrayList; import interfaces.HoleInterface;   public class Rat implements RatInterface { private int ratEnergy = 5; @Override public String move() { // TODO Auto-generated method stub returnnull; }   @Override publicint getAliveState() { // TODO Auto-generated method stub return 0; }   @Override publicvoid refresh() { ratEnergy = 5; }   @Override publicvoid wearDown() { ratEnergy -= 1; }   @Override public String getId() { // TODO Auto-generated method stub returnnull; }   } This is an ratInterface that describes what should be inputted in the rat Class program: package interfaces;   /** * * @author Owner * */   public interface RatInterface {   /** * The move() method has the rat randomly select one of the eight possible moves directions. * (N, NW, W, SW, S, SE, E, NE); * @Precondition: None * @Postcondition: None * @return * the unbiased, randomly generated, direction to move the rat */ public String move();   /** * The getAliveState() method returns the alive status of the rat. * 0 Rat is alive, 1 Rat is dead of exhaustion * @Precondition: the Rat's alive status has been initialized * @Postcondition: no change in the mouse's state * @return * the integer value of the mouse's alive status */ publicint getAliveState();   /** * Rat is refreshed * Clears away exhaustion */ publicvoid refresh(); /** * Rat gets a little more exhausted * If exhaustion gets too low Rat dies. */ publicvoid wearDown(); /** * Retrieve the Rat's ID */ public String getId();   }

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter19: Probabilistic Dynamic Programming
Section19.4: Further Examples Of Probabilistic Dynamic Programming Formulations
Problem 7P
icon
Related questions
Question

I need help with this Java program over a Rat class program shown below detailed on the given image:

package classPackage;

 

import interfaces.RatInterface;

import interfaces.CellInterface;

import java.util.ArrayList;

import interfaces.HoleInterface;

 

public class Rat implements RatInterface {

private int ratEnergy = 5;

@Override

public String move() {

// TODO Auto-generated method stub

returnnull;

}

 

@Override

publicint getAliveState() {

// TODO Auto-generated method stub

return 0;

}

 

@Override

publicvoid refresh() {

ratEnergy = 5;

}

 

@Override

publicvoid wearDown() {

ratEnergy -= 1;

}

 

@Override

public String getId() {

// TODO Auto-generated method stub

returnnull;

}

 

}

This is an ratInterface that describes what should be inputted in the rat Class program:

package interfaces;

 

/**

*

* @author Owner

*

*/

 

public interface RatInterface

{

 

/**

* The move() method has the rat randomly select one of the eight possible moves directions.<br>

* (N, NW, W, SW, S, SE, E, NE);<br>

* @Precondition: None

* @Postcondition: None

* @return

* the unbiased, randomly generated, direction to move the rat

*/

public String move();

 

/**

* The getAliveState() method returns the alive status of the rat.

* 0 Rat is alive, 1 Rat is dead of exhaustion

* @Precondition: the Rat's alive status has been initialized

* @Postcondition: no change in the mouse's state

* @return

* the integer value of the mouse's alive status

*/

publicint getAliveState();

 

/**

* Rat is refreshed

* Clears away exhaustion

*/

publicvoid refresh();

/**

* Rat gets a little more exhausted

* If exhaustion gets too low Rat dies.

*/

publicvoid wearDown();

/**

* Retrieve the Rat's ID

*/

public String getId();

 

}

 

The Rat class will
implement the RatInterface
• maintain an exhaustion/refreshment level
• hold its "alive" status
●
o Rat is capable of reporting 2 different statuses
-alive
-exhausted to death
provide a (North, Northwest, West, Southwest, South,
Southeast, East, Northeast) movement direction when
prompted.
• refreshes or wears down by 1 unit when entering a
cell(Cell or Hole) ( This is an example, you may
implement this with different rates of "wear"!)
o if it wears down below 6 it dies of exhaustion
Transcribed Image Text:The Rat class will implement the RatInterface • maintain an exhaustion/refreshment level • hold its "alive" status ● o Rat is capable of reporting 2 different statuses -alive -exhausted to death provide a (North, Northwest, West, Southwest, South, Southeast, East, Northeast) movement direction when prompted. • refreshes or wears down by 1 unit when entering a cell(Cell or Hole) ( This is an example, you may implement this with different rates of "wear"!) o if it wears down below 6 it dies of exhaustion
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole