-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOcelot.java
More file actions
46 lines (39 loc) · 1.18 KB
/
Copy pathOcelot.java
File metadata and controls
46 lines (39 loc) · 1.18 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
public class Ocelot extends Animal implements Running, Swimming
{
private int coolness;
public Ocelot(int coolness)
{
super("Ocelot", "A small cat from Central and South America with golden patterned fur.");
this.coolness = coolness;
}
public Ocelot(int coolness, String name, String desc)
{
super(name, desc);
this.coolness = coolness;
}
@Override
public String play(){
return "It runs over, swats playfully at you, and then immediately lays down, exposing its\n" +
"soft underbelly.";
}
@Override
public String eat(){
return "It dives into a nearby river, emerging with a shiny fish.";
}
@Override
public String makeNoise(){
String noise = "";
for (int i = 0; i <= coolness; i++){
noise += "rrrwrwrrrRAWRrrwrwrrw";
}
return noise;
}
@Override
public String run(){
return "It lithely springs away from you, gracefully covering ground.";
}
@Override
public String swim(){
return "It jumps into a nearby river, tail swishing from side to side like a dappled rudder.";
}
}