-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatientManager.java
More file actions
44 lines (35 loc) · 1017 Bytes
/
PatientManager.java
File metadata and controls
44 lines (35 loc) · 1017 Bytes
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
import java.util.ArrayList;
public class PatientManager {
public ArrayList<Patient> patients;
public PatientManager(){
this.patients=new ArrayList<Patient>(10);
}
public int Add(Patient patient){
patients.add(patient);
return patients.indexOf(patient);
}
public Patient removePatient(int num){
Patient temp=patients.remove(num);
return temp;
}
public void caffineAbsorbtion(){
for (int i=0;i<patients.size();i++){
patients.get(i).caffineLevel-=160;
if (patients.get(i).caffineLevel<=0){
patients.remove(i);
i--;
}
}
}
@Override
public String toString(){
String ret="";
for (int i=0;i<patients.size();i++){
ret+= "ID: "+patients.get(i).IDNumber+"; Caffine: "+patients.get(i).caffineLevel+"\n";
}
if (ret==""){
return "Empty";
}
return ret;
}
}