-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClothing.java
More file actions
54 lines (44 loc) · 1.41 KB
/
Clothing.java
File metadata and controls
54 lines (44 loc) · 1.41 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
package module5.datastructures.stackqueue;
/**
* Clothing
*/
public class Clothing {
private final String name;
private final String color;
private final boolean machineWashable;
/** Create a new article of Clothing
* @param color The color of the clothing (ex. "red")
* @param name The name of the clothing (ex. "shirt")
* @param machineWashable Whether the clothing is machine washable
*/
public Clothing(String color, String name, boolean machineWashable) {
this.name = name;
this.color = color;
this.machineWashable = machineWashable;
}
/** @return the name of the clothing */
public String getName() {
return this.name;
}
/** @return the color of the clothing */
public String getColor() {
return this.color;
}
/** @return whether or not the clothing is machine-washable */
public boolean getMachineWashable() {
return this.machineWashable;
}
/** @return whether or not the clothing is machine-washable */
public boolean isMachineWashable() {
return getMachineWashable();
}
@Override
/**
* @return a string representation of the string, like
* {@code "red hoodie (machine-washable)"}
*/
public String toString() {
return color + " " + name
+ (machineWashable ? " (machine-washable)" : "");
}
}