Question 1: Abstract Data Types (12 marks)
• Place all of your code ﬁles for this question in a sub-folder called question1.
In this question you will design and implement a set of ADTs for representing simple information
about a hospital. You should carefully consider your design and implementation as this question
contains a number of details. You are marked on the quality of your design and implementation.
Just “making the code work” is insuﬃcient to receive full marks. Rushed, quick or ill-considered
work will often results in poor marks.
Design & Functionality
You will need to design and implement 3 ADTs:
You may implement additional classes to support these ADTs. However, remember that you are
marked on the quality of your design. Excessive classes may be considered poor design.
The Patient ADT represents simple information about a patient. This information must include:
1. The name, such as “John Doe” or “Jane Doe”.
2. Date of birth. such as 10-2-1965.
3. A registration number, such as 1234567. You may assume that registration numbers are
unique for all patients (but you do not need to check this).
4. Admission history. This would be a ordered list of entries where each entry contain the
information: admission date, discharge date (if applicable), admitted ward.
5. Support the use of the operator operator<<, that enables the data stored about a patient
to be written to an output stream.
The PatientRegister ADT holds the set of all patients that has received (or is receiving) treat-
ment at the hospital. The ADT should support the following functionality:
1. Add a patient to the register.
2. Remove a patient from the register.
3. Get the number of patients in the register.
4. Check if a patient is in the register.
5. Retrieve an individual patient stored within the register.
6. Ensure that there are no duplicate patients in the register, which is determined by the
patient’s registration numbers.
7. Support the use of the operator operator, to retrieve a patients by his/her registration
You will need to think about the parameters you need for the methods of the ADT to support this
The Ward ADT represents multiple sub-sets of patients. The ADT should support the following
1. Contain 5 wards (sub-sets), with each ward having a unique identifying name.
2. Add a patient to a ward.
3. Remove a patient from a ward.
4. Get the number of patients in all ward.
5. Get the number of patients in a speciﬁc ward.
6. Get the ward that a patient is in.
7. Support the use of the operator operator to retrieve the collection of all the patients that
are in a given ward.
Note that a patient may only be placed in one ward. You will need to think about the parameters
you need for to the methods of the ADT to support this functionality.
You may choose a suitable underlying representation for each ADT including:
• Single or double-ended linked list
• C++14 STL ordered container (array, vector, list, deque, stack, queue)
• C++14 STL associative container (set, map)