Repository navigation
Expand file tree
/
Copy pathCouch.java
More file actions
62 lines (55 loc) · 1.71 KB
/
Copy pathCouch.java
File metadata and controls
62 lines (55 loc) · 1.71 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
package house;
public class Couch{
/* Fields ********************************************************************************/
private int length;
private int width;
private boolean isFuton;
private Fabric fabric;
/* Constructors **************************************************************************/
public Couch(int length, int width, boolean isFuton, Fabric fabric){
this.length = length;
this.width = width;
this.isFuton = isFuton;
this.fabric = fabric;
}
public Couch(){
this(0, 0, false, new Fabric() );
}
/* Getters *********************************************************************/
public int getLength(){
return length;
}
public int getWidth(){
return width;
}
public boolean getIsFuton(){
return isFuton;
}
public Fabric getFabric(){
return fabric;
}
/* Setters **********************************************************************/
public void setLength(int length){
this.length = length;
}
public void setWidth(int width){
this.width = width;
}
public void setIsFuton(boolean isFuton){
this.isFuton = isFuton;
}
public void setFabric(String color, String material, boolean machineWashable){
fabric.setColor(color);
fabric.setMaterial(material);
fabric.setMachineWashable(machineWashable);
}
/* Methods *******************************************************************************/
public String printInfo(){
if(isFuton){
return("The length of the couch is: " + getLength() + " the width of the couch is: " + getWidth() + " the couch is a futon " + fabric.printInfo());
}
else{
return("The length of the couch is: " + getLength() + " the width of the couch is: " + getWidth() + " the couch is a not a futon " + fabric.printInfo());
}
}
}