-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathRaven.java
More file actions
69 lines (57 loc) · 1.72 KB
/
Raven.java
File metadata and controls
69 lines (57 loc) · 1.72 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
package model;
public class Raven {
// Private instance variables to store Raven properties
private String habitat;
private String name;
private int length;
private String featherColor;
// Constructor to initialize Raven object with specified properties
public Raven(String habitat, String name, int length, String featherColor) {
this.habitat = habitat;
this.name = name;
this.length = length;
this.featherColor = featherColor;
}
// Getter method for habitat
public String getHabitat() {
return habitat;
}
// Setter method for habitat
public void setHabitat(String habitat) {
this.habitat = habitat;
}
// Getter method for name
public String getName() {
return name;
}
// Setter method for name
public void setName(String name) {
this.name = name;
}
// Getter method for length
public int getLength() {
return length;
}
// Setter method for length
public void setLength(int length) {
this.length = length;
}
// Getter method for featherColor
public String getFeatherColor() {
return featherColor;
}
// Setter method for featherColor
public void setFeatherColor(String featherColor) {
this.featherColor = featherColor;
}
// Override toString method to provide a string representation of the Raven object
@Override
public String toString() {
return "Raven [name=" + name + ", length=" + length + " inches, habitat=" + habitat +
", featherColor=" + featherColor + "]";
}
// Method to simulate the noise a Raven makes
public String makeNoise() {
return "Caw! Caw!";
}
}