-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMimicOctopus.java
More file actions
35 lines (35 loc) · 840 Bytes
/
Copy pathMimicOctopus.java
File metadata and controls
35 lines (35 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class MimicOctopus extends Octopus
{
public MimicOctopus()
{
super("Mimic Octopus", "An octopus that can shapeshift. We are screwed.");
}
@Override
public String play()
{
String randomAnimal;
if(Math.random()< .5)
{
randomAnimal = "a poisonous flatfish";
}
else
{
randomAnimal = "a lion fish";
}
return super.play()+"Now the mimic octopus mimics " + randomAnimal + ".";
}
@Override
public String makeNoise()
{
String randomAnimal;
if(Math.random()< .5)
{
randomAnimal = "deadly sea snake";
}
else
{
randomAnimal = "upright perportuane";
}
return "The octopus mimics the noise of the "+ randomAnimal+ ".";
}
}