-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaptop.java
More file actions
86 lines (80 loc) · 2.32 KB
/
Copy pathlaptop.java
File metadata and controls
86 lines (80 loc) · 2.32 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
public class laptop{
private String color;
private Integer RAM;
private String OS;
private Integer HDD;
private Integer id;
private String brand;
private String model;
private boolean isBooked = false;
public laptop(String model,Integer id, String brand){
this.model = model;
this.brand = brand;
this.id = id;
System.out.println("Ноутбук марки "+"'"+ this.brand+"'"+" Модель "+this.model+" С id " +Integer.toString(this.id));
}
public String getColor(){
return this.color;
}
public Integer getRAM(){
return this.RAM;
}
public String getOS(){
return this.OS;
}
public Integer getHDD(){
return this.HDD;
}
public Integer getid(){
return this.id;
}
public String getBrand(){
return this.brand;
}
public String getModel(){
return this.model;
}
public Boolean getBooking(){
return this.isBooked;
}
public void setColor(String color){
this.color =color;
}
public void setRAM(Integer RAM){
this.RAM = RAM;
}
public void setOS(String OS){
this.OS = OS;
}
public void setHDD(Integer HDD){
this.HDD = HDD;
}
public void Book(){
if (isBooked==false){
this.isBooked=true;
}
else System.out.println("Этот ноутбук уже зарезервирован");
}
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append("Ноутбук ");
sb.append(this.id);
sb.append(System.lineSeparator());
sb.append(this.color);
sb.append(" ");
sb.append(this.brand);
sb.append(" ");
sb.append(this.model);
sb.append(System.lineSeparator());
sb.append("OS "+this.OS);
sb.append(System.lineSeparator());
sb.append("HDD "+this.HDD);
sb.append(System.lineSeparator());
sb.append("RAM "+this.RAM);
sb.append(System.lineSeparator());
if(this.isBooked==false) sb.append("Не зарезервирован");
else sb.append("Зарезервирован");
return(sb.toString());
}
}