# 1. Goal A laboratory receives blood samples. Each sample has a sample ID, a test type and a priority. The laboratory groups the samples into batches. One batch belongs to each test type. A laboratory program adds the samples one by one. Then it reads the batches. Create the class {{P}}SAMPLE_BATCHER. The class collects the samples and gives the batches. # 2. Open questions None. # 3. Context - The class is new. It is in package $TMP. - No other object is necessary. - A laboratory program creates one instance of the class. It adds all samples of a shift. Then it reads the batches. # 4. Contract Class {{P}}SAMPLE_BATCHER. The class is public and final. It can be created without parameters. Public types: - ty_test_type TYPE c LENGTH 4 - ty_sample_id TYPE c LENGTH 10 - ty_priority TYPE i - ty_batch with the components test_type (TYPE ty_test_type), total (TYPE i) and urgent (TYPE i) - tt_batches TYPE STANDARD TABLE OF ty_batch WITH EMPTY KEY Public methods: - add_sample IMPORTING iv_sample_id TYPE ty_sample_id iv_test_type TYPE ty_test_type iv_priority TYPE ty_priority RETURNING VALUE(rv_added) TYPE abap_bool - get_batches RETURNING VALUE(rt_batches) TYPE tt_batches - get_batch IMPORTING iv_test_type TYPE ty_test_type RETURNING VALUE(rs_batch) TYPE ty_batch Do not add other public methods. # 5. Business rules add_sample 1. Normalize the sample ID and the test type. Remove all spaces. Convert all letters to upper case. 2. Reject the sample and return abap_false if one of these conditions is true: - the normalized sample ID is empty, or - the normalized test type is empty, or - the priority is not 1, 2 or 3, or - the normalized sample ID was already added. The state of the object does not change. 3. Else accept the sample and return abap_true. The batch of the test type gets one more sample. If the priority is 1, the batch also gets one more urgent sample. get_batches 4. Return one row for each test type that has at least one sample. 5. Sort the rows by the test type in ascending order. get_batch 6. Normalize the test type in the same way as in rule 1. 7. If the test type has at least one sample, return its row. 8. Else return a row with this test type, total = 0 and urgent = 0. # 6. Constraints - Release target: 8.16. - Coding standards: Clean ABAP. Methods below 40 statements. No global variables. No comment that restates the code. - Out of scope: no other object is part of this task. # 7. Acceptance - The class is active and has no syntax error. - The hidden tests pass. - Write your own ABAP Unit tests for the class.