forked from SPHS-CS/JavaZoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBear.java
More file actions
47 lines (43 loc) · 974 Bytes
/
Copy pathBear.java
File metadata and controls
47 lines (43 loc) · 974 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
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.List;
import java.util.ArrayList;
/**
* Write a description of class Bear here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Bear
{
private String appearance;
private List<String> toys;
/**
* Constructor for objects of class Bear
*/
public Bear()
{
appearance = "This a standard looking bear in all respects. Use your imagination.";
toys = new ArrayList<String>();
toys.add("Plush Fish");
}
public String roar()
{
return "RAAAAAAAAAAWR";
}
public String sleep()
{
return "zzzzzzzzz";
}
public String play()
{
String playing = "";
for(String toy : toys)
{
playing += "The bear plays with his "+ toy +".\n";
}
return playing;
}
public String eat()
{
return "The bear reaches through the bars and eats a volunteer";
}
}