| Modifier and Type | Field and Description |
|---|---|
private int |
tenacity
RedMartians have an tenacity which is simply an integer. |
| Constructor and Description |
|---|
RedMartian(int id,
int tenacity)
Creates a
RedMartian with the specified id and tenacity
and volume is set to 1. |
RedMartian(int id,
int volume,
int tenacity)
Creates a
RedMartian with the specified id, volume, and tenacity. |
| Modifier and Type | Method and Description |
|---|---|
int |
getTenacity()
Returns the
tenacity of this Martian. |
int |
power()
Returns the
power of this Martian which is defined as twice the volume
and then add the tenacity. |
void |
setTenacity(int tenacity)
Set the
tenacity for the Martian |
String |
speak()
Returns a string in this exact format:
|
String |
toString()
Returns a string in this exact format:
|
public RedMartian(int id,
int tenacity)
RedMartian with the specified id and tenacity
and volume is set to 1.id - tenacity - public RedMartian(int id,
int volume,
int tenacity)
RedMartian with the specified id, volume, and tenacity.id - volume - tenacity - public int getTenacity()
tenacity of this Martian.tenacity for the Martian.public int power()
power of this Martian which is defined as twice the volume
and then add the tenacity.public void setTenacity(int tenacity)
tenacity for the Martiantenacity - The new tenacitypublic String speak()
id=X, Rubldy Rockwhere
X is the id