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();   }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education