Repository navigation
Expand file tree
/
Copy pathBed.java
More file actions
61 lines (56 loc) · 1.83 KB
/
Copy pathBed.java
File metadata and controls
61 lines (56 loc) · 1.83 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
package house;
enum BedSize{
noBed, twin, full, queen, king, CaliforniaKing;
}
public class Bed{
/* Fields ********************************************************************************/
BedSize bedsize;
boolean hasHeadboard;
String colorOfSheets;
/* Constructors **************************************************************************/
public Bed(BedSize bedsize, boolean hasHeadboard, String colorOfSheets){
this.bedsize = bedsize;
this.hasHeadboard = hasHeadboard;
this.colorOfSheets = colorOfSheets;
}
public Bed(String bedsize, boolean hasHeadboard, String colorOfSheets){
this.bedsize = BedSize.valueOf(bedsize);
this.hasHeadboard = hasHeadboard;
this.colorOfSheets = colorOfSheets;
}
public Bed(){
this(BedSize.noBed, false, "");
}
/* Getters *******************************************************************************/
public BedSize getBedSize(){
return bedsize;
}
public boolean getHasHeadboard(){
return hasHeadboard;
}
public String getColorOfSheets(){
return colorOfSheets;
}
/* Setters *******************************************************************************/
public void setBedSize(BedSize bedSize){
this.bedsize = bedSize;
}
public void setBedSize(String bedSize){
this.bedsize = BedSize.valueOf(bedSize);
}
public void setHasHeadBoard(boolean hasHeadboard){
this.hasHeadboard = hasHeadboard;
}
public void setColorOfSheets(String color){
this.colorOfSheets = color;
}
/* Methods *********************************************************************/
public String printInfo(){
if(hasHeadboard){
return("The bedsize is: " + getBedSize() + " there is a headboard " + " the color of the sheets is: " + getColorOfSheets() );
}
else{
return("The bedsize is: " + getBedSize() + " there is not a headboard " + " the color of the sheets is: " + getColorOfSheets() );
}
}
}