-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathFrog.java
More file actions
executable file
·72 lines (62 loc) · 1.55 KB
/
Frog.java
File metadata and controls
executable file
·72 lines (62 loc) · 1.55 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
71
import java.util.List;
import java.util.ArrayList;
/**
* Write a description of class Frog here.
*
* @author Sheldon Zhu
* @version 2015-03-19
*/
public class Frog extends Animal implements Swimmable, Roamable
{
private List<String> toys;
public Frog()
{
super("A typical green frog that appears to be staring straight into your soul.", "Tyler");
toys = new ArrayList<String>();
toys.add("Barbie Doll");
}
public Frog(String desc, String name)
{
super (desc, name);
toys = new ArrayList<String>();
toys.add("Barbie Doll");
}
@Override
public String play()
{
String playing = "";
for(String toy : toys)
{
playing += (getName() + " plays with his "+ toy +".\n");
}
return playing;
}
@Override
public String sleep()
{
return "Zzzzzzz...";
}
@Override
public String eat()
{
return getName() + "'s tongue darts out and plucks a fly out of the air.";
}
@Override
public String makeNoise()
{
return "Ribbit";
}
@Override
public String move()
{
return getName() + " leaps straight out of its tank and stares into your very being.";
}
public String swim()
{
return getName() + " hops in the water and wades around for a minute.";
}
public String roam()
{
return getName() + " hops out of his tank and roams around the zoo, as if searching for something.";
}
}