add the deletePatient method from the notes
The test shows there is a bug - the check is simply on the name and so wrong
patient can be deleted as shown here where first Henry goes rather than 2nd:
$ java HospitalManager
There are 10 patients:
 Patient "John" is 33 years and suffers from "Tuberculosis"
 Patient "Mary" is 66 years and suffers from "Meningitis"
 Patient "Harry" is 23 years and suffers from "Ebola"
 Patient "Henry" is 7 years and suffers from "Measles"
 Patient "Lucy" is 17 years and suffers from "Acne"
 Patient "Larry" is 41 years and suffers from "HIV"
 Patient "Henry" is 47 years and suffers from "Broken leg"
 Patient "Kate" is 77 years and suffers from "Dementia"
 Patient "Elizabeth" is 103 years and suffers from "Bone loss"
 Patient "Nigel" is 20 years and suffers from "Diabetes"
Delete the 2nd older Henry returns true
There are 9 patients:
 Patient "John" is 33 years and suffers from "Tuberculosis"
 Patient "Mary" is 66 years and suffers from "Meningitis"
 Patient "Harry" is 23 years and suffers from "Ebola"
 Patient "Lucy" is 17 years and suffers from "Acne"
 Patient "Larry" is 41 years and suffers from "HIV"
 Patient "Henry" is 47 years and suffers from "Broken leg"
 Patient "Kate" is 77 years and suffers from "Dementia"
 Patient "Elizabeth" is 103 years and suffers from "Bone loss"
 Patient "Nigel" is 20 years and suffers from "Diabetes"
sort bug by extending comparison to all the fields.
Cannot use .equals as it would have to overrided and this
is a bit complicated http://www.artima.com/lejava/articles/equality.html
Test output
$ java HospitalManager
There are 10 patients:
 Patient "John" is 33 years and suffers from "Tuberculosis"
 Patient "Mary" is 66 years and suffers from "Meningitis"
 Patient "Harry" is 23 years and suffers from "Ebola"
 Patient "Henry" is 7 years and suffers from "Measles"
 Patient "Lucy" is 17 years and suffers from "Acne"
 Patient "Larry" is 41 years and suffers from "HIV"
 Patient "Henry" is 47 years and suffers from "Broken leg"
 Patient "Kate" is 77 years and suffers from "Dementia"
 Patient "Elizabeth" is 103 years and suffers from "Bone loss"
 Patient "Nigel" is 20 years and suffers from "Diabetes"
Delete the 2nd older Henry returns true
There are 9 patients:
 Patient "John" is 33 years and suffers from "Tuberculosis"
 Patient "Mary" is 66 years and suffers from "Meningitis"
 Patient "Harry" is 23 years and suffers from "Ebola"
 Patient "Henry" is 7 years and suffers from "Measles"
 Patient "Lucy" is 17 years and suffers from "Acne"
 Patient "Larry" is 41 years and suffers from "HIV"
 Patient "Kate" is 77 years and suffers from "Dementia"
 Patient "Elizabeth" is 103 years and suffers from "Bone loss"
 Patient "Nigel" is 20 years and suffers from "Diabetes"
now the older Henry is removed
remove the first patient
do this by changing the pointer to the address for the 2nd object
Test output showing it works
$ java HospitalManager
There are 10 patients:
 Patient "John" is 33 years and suffers from "Tuberculosis"
 Patient "Mary" is 66 years and suffers from "Meningitis"
 Patient "Harry" is 23 years and suffers from "Ebola"
 Patient "Henry" is 7 years and suffers from "Measles"
 Patient "Lucy" is 17 years and suffers from "Acne"
 Patient "Larry" is 41 years and suffers from "HIV"
 Patient "Henry" is 47 years and suffers from "Broken leg"
 Patient "Kate" is 77 years and suffers from "Dementia"
 Patient "Elizabeth" is 103 years and suffers from "Bone loss"
 Patient "Nigel" is 20 years and suffers from "Diabetes"
Delete the 2nd older Henry returns true
There are 9 patients:
 Patient "John" is 33 years and suffers from "Tuberculosis"
 Patient "Mary" is 66 years and suffers from "Meningitis"
 Patient "Harry" is 23 years and suffers from "Ebola"
 Patient "Henry" is 7 years and suffers from "Measles"
 Patient "Lucy" is 17 years and suffers from "Acne"
 Patient "Larry" is 41 years and suffers from "HIV"
 Patient "Kate" is 77 years and suffers from "Dementia"
 Patient "Elizabeth" is 103 years and suffers from "Bone loss"
 Patient "Nigel" is 20 years and suffers from "Diabetes"
Remove the first patient
There are 8 patients:
 Patient "Mary" is 66 years and suffers from "Meningitis"
 Patient "Harry" is 23 years and suffers from "Ebola"
 Patient "Henry" is 7 years and suffers from "Measles"
 Patient "Lucy" is 17 years and suffers from "Acne"
 Patient "Larry" is 41 years and suffers from "HIV"
 Patient "Kate" is 77 years and suffers from "Dementia"
 Patient "Elizabeth" is 103 years and suffers from "Bone loss"
 Patient "Nigel" is 20 years and suffers from "Diabetes"