public class GreenMartian extends Martian implements Teleporter
GreenMartian which is a subclass of Martian| Constructor and Description |
|---|
GreenMartian(int id)
Creates a
GreenMartian with the specified id and volume is set to 1. |
GreenMartian(int id,
int volume)
Creates a
GreenMartian with the specified id and volume |
| Modifier and Type | Method and Description |
|---|---|
int |
power()
Returns the power of this
GreenMartian which is defined as 3 times the volume. |
String |
speak()
Returns a string in this exact format:
|
String |
teleport(String dest)
Returns a string in this exact format:
|
String |
toString()
Returns a string in this exact format:
|
public GreenMartian(int id)
GreenMartian with the specified id and volume is set to 1.id - public GreenMartian(int id,
int volume)
GreenMartian with the specified id and volumeid - volume - public int power()
GreenMartian which is defined as 3 times the volume.public String speak()
id=X, Grobldy Grockwhere
X is the idpublic String teleport(String dest)
id=X teleporting to dest
where X is the id and dest is the destination for the teleportationteleport in interface Teleporterdest - This is the destination for the teleportation and is used in the
string that this method returns.