-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathWolf.java
More file actions
134 lines (105 loc) · 2.14 KB
/
Wolf.java
File metadata and controls
134 lines (105 loc) · 2.14 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
* @author abhit - aryan9
* CIS175 - Spring 2023
* Jan 17, 2023
*/
package model;
public class Wolf {
private String name; //type String represents the Wolf's name
private String eyeColor; //type String represents the Wolf's eye color
private int size; //type Integer represents the Wolf's body size or height
//public non-default constructor w/ 3 parameters
public Wolf(String wolfName, String wolfEyeColor, int wolfSize) {
super();
this.name = wolfName;
this.eyeColor = wolfEyeColor;
this.size = wolfSize;
}
/**
* @return the eyeColor
*/
public String getEyeColor() {
return eyeColor;
}
/**
* @param eyeColor the eyeColor to set
*/
public void setEyeColor(String eyeColor) {
this.eyeColor = eyeColor;
}
/**
* @return the size
*/
public int getSize() {
return size;
}
/**
* @param size the size to set
*/
public void setSize(int size) {
this.size = size;
}
//public method of return type String called 'speak()' returns the sound that the wolf makes
public String speak() {
return "Howl!";
}
@Override
public String toString() {
return "Wolf [name=" + name + ", eyeColor=" + eyeColor + ", size(in inches)=" + size + "]";
}
//declare variables
private String habitat;
private String color;
//default constructor
public Wolf(){
super();
}
//constructor with parameters
public Wolf(String name, String habitat, String color) {
super();
this.name = name;
this.habitat = habitat;
this.color = color;
}
//getters and setters
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the habitat
*/
public String getHabitat() {
return habitat;
}
/**
* @param habitat the habitat to set
*/
public void setHabitat(String habitat) {
this.habitat = habitat;
}
/**
* @return the color
*/
public String getColor() {
return color;
}
/**
* @param color the color to set
*/
public void setWeight(String color) {
this.color = color;
}
//make noise method
public String makeNoise() {
return "Awooooooo";
}
}