-
Notifications
You must be signed in to change notification settings - Fork 0
/
PatientTest.java
68 lines (62 loc) · 2.65 KB
/
PatientTest.java
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
public class PatientTest{
public static void main(String[] args){
Patient patientListBegin = null;
Patient patientListEnd = null;
Patient firstPatient = new Patient("John", 33, "Tuberculosis");
Patient secondPatient = new Patient("Derek", 45,"Consumption");
Patient thirdPatient = new Patient("Jill", 19, "Plague");
Patient fourthPatient = new Patient("Boris", 14,"Smallpox");
Patient fifthPatient = new Patient("Mark", 52, "Quinsy");
Patient sixthPatient = new Patient("Charlotte", 23,"Malaria");
Patient seventhPatient = new Patient("Pippa", 65, "Sickle-celled Anaemia");
Patient eighthPatient = new Patient("Susan", 35,"Herpes");
Patient ninthPatient = new Patient("Roger", 77, "Violetta");
Patient tenthPatient = new Patient("Betty", 53,"Turpett");
patientListBegin = firstPatient;
patientListBegin.addPatient(secondPatient);
patientListBegin.addPatient(thirdPatient);
patientListBegin.addPatient(fourthPatient);
patientListBegin.addPatient(fifthPatient);
patientListBegin.addPatient(sixthPatient);
patientListBegin.addPatient(seventhPatient);
patientListBegin.addPatient(eighthPatient);
patientListBegin.addPatient(ninthPatient);
patientListBegin.addPatient(tenthPatient);
patientListEnd = tenthPatient;
patientListEnd.addPatient(ninthPatient);
patientListEnd.addPatient(eighthPatient);
patientListEnd.addPatient(seventhPatient);
patientListEnd.addPatient(sixthPatient);
patientListEnd.addPatient(fifthPatient);
patientListEnd.addPatient(fourthPatient);
patientListEnd.addPatient(thirdPatient);
patientListEnd.addPatient(secondPatient);
patientListEnd.addPatient(firstPatient);
patientListBegin.deletePatient(fourthPatient);
patientListBegin.deletePatient(eighthPatient);
Patient pos = patientListBegin;
System.out.println(pos.getName());
System.out.println(pos.getIllness());
System.out.println(pos.getAge());
System.out.println("");
Patient pos2 = patientListEnd;
System.out.println(pos2.getName());
System.out.println(pos2.getIllness());
System.out.println(pos2.getAge());
System.out.println("");
while(pos.getNextPatient() != null){
System.out.println(pos.getNextPatient().getName());
System.out.println(pos.getNextPatient().getIllness());
System.out.println(pos.getNextPatient().getAge());
System.out.println(" ");
pos=pos.getNextPatient();
}
while(!pos.getPrevPatient().getName().equals("John")){
System.out.println(pos.getPrevPatient().getName());
System.out.println(pos.getPrevPatient().getIllness());
System.out.println(pos.getPrevPatient().getAge());
System.out.println(" ");
pos=pos.getPrevPatient();
}
}
}