-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNarwhal.java
More file actions
71 lines (61 loc) · 1.64 KB
/
Copy pathNarwhal.java
File metadata and controls
71 lines (61 loc) · 1.64 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
public class Narwhal extends Animal implements Swimming
{
private int age;
private int horn;
public Narwhal(int horn)
{
super("Pet Narwhal", "This is a fat sea dog with a unicorn horn.");
age = 0;
horn = 0;
}
public Narwhal(String name, String description)
{
super(name, description);
}
public int getAge()
{
return age;
}
@Override
public String play()
{
return "You throw it a bone. You idiot. Just because it's a sea dog /n" +
"doesn't mean it enjoys chewing on bones like your Pomeranian /n" +
"at home.";
}
@Override
public String makeNoise()
{
return "BBOOEEEUUUUURGGGHHHHHAAAAAAAAAAAARGHHHHHHNGHHHHHHH";
}
@Override
public String eat()
{
int choice = (int)(Math.random() * 3);
if(choice == 0)
{
return "The narwhal leaves you in order to find some food." +
"/n" +
"/n" +
"Unfortunately, it never returns.";
}
else if(choice == 1)
{
return "The narwhal waits patiently, and the boat you came here /n" +
"with throws a giant sack of fish in the water." +
"/n" +
"/n" +
"You have done a good thing today. You fed a unicorn sea dog.";
}
else
{
return "The narwhal swallows you whole. Making a pet of wild animals /n" +
"was a bad idea.";
}
}
@Override
public String swim()
{
return "nyoom nyoom there the sea dog goes";
}
}