-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevice.java
More file actions
103 lines (92 loc) · 3.47 KB
/
device.java
File metadata and controls
103 lines (92 loc) · 3.47 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
public class device {
public int device_id;
private String type;
private String deviceStatus;
public device(int device_id, String type, String deviceStatus){
this.device_id = device_id;
this.type = type;
this.deviceStatus = "avilable";
}
public class device {
public int device_id;
private String type;
private String deviceStatus;
//--------------------------------------------------//
// class constructor:
public device(int device_id, String type, String deviceStatus){
this.device_id = device_id;
this.type = type;
this.deviceStatus = "avilable";
}
//--------------------------------------------------//
// methods: checkout, return:
// checkoutDevice:
public void checkoutDevice() {
if (this.deviceStatusstatus.equals("available")) {
this.deviceStatusstatus = "checked out";
System.out.println("Device with the ID " + this.device_id + " has been checked out.");
} else {
System.out.println("Device with the ID " + this.device_id + " is not available for checkout.");
}
}
// returnDevice:
public void returnDevice() {
if (this.deviceStatusstatus.equals("checked out")) {
this.deviceStatusstatus = "available";
System.out.println("Device with the ID " + this.device_id + " has been returned.");
} else {
System.out.println("device with the ID " + this.device_id + " is not checked out.");
}
}
//----------------------------------------------------//
// class device setters and getters:
// type setter:
public void setType(String type){
if (type == " laptop" || type=="ipad"){
this.type=type;
}
else{System.out.println("You need to enter laptop or ipad...");}
}
// type getter:
public String getType(){
return this.type;
}
// status setter:
public void setdeviceStatus(String deviceStatus){
if (deviceStatus == "avilable" || deviceStatus=="checkout"){
this.deviceStatus=deviceStatus;
}
else{System.out.println("You need to enter avilable or checkout...");}
}
// status getter:
public String getdeviceStatus(){
return this.deviceStatus;
}
}
public String getType(){
return this.type;
}
public void setType(String type){
if (type == " laptop" || type=="ipad"){
this.type=type;
}
else{System.out.println("You need to enter laptop or ipad...");}
}
public String getdeviceStatus(){
return this.deviceStatus;
}
public void setdeviceStatus(String deviceStatus){
if (deviceStatus == "avilable" || deviceStatus=="checkout"){
this.deviceStatus=deviceStatus;
}
else{System.out.println("You need to enter avilable or checkout...");}
}
//public void addDevice(Device device) {
//availableDevices[availableCount++] = device;
//}
//void checkoutDevices(int device_id) {
// this.checkouts = this.acc.checkouts + 1;
// this.deviceStatus = "checked out";
// System.out.println("Device with id: " + device_id + "has been checked");
// }
}