Files
abap-llm/tasks_gen/train/G1311/spec.md

6 lines
1.6 KiB
Markdown

Create the public final class {{P}}FISH_AUCTION. It has a public constructor without parameters. Define these public types: TY_SPECIES (character 10), TY_BOAT_ID (character 10), TY_CATCH (structure with BOAT_ID type TY_BOAT_ID, SPECIES type TY_SPECIES, WEIGHT_KG type i), TT_CATCH (table type of TY_CATCH; it can hold more than one entry with the same boat ID and species), TY_SUMMARY (structure with SPECIES type TY_SPECIES, TOTAL_WEIGHT type i, BOAT_COUNT type i), and TT_SUMMARY (table type of TY_SUMMARY). Add these public methods: SUMMARIZE importing IT_CATCH type TT_CATCH returning RT_SUMMARY type TT_SUMMARY; BEST_SPECIES importing IT_CATCH type TT_CATCH returning RV_SPECIES type TY_SPECIES. Do not add other public methods.
SUMMARIZE must: not change IT_CATCH. For each entry, build a species key: remove leading and trailing blanks from SPECIES and convert all letters to upper case. Ignore the entry if the species key is empty. Ignore the entry if WEIGHT_KG is zero or less. Group the remaining entries by the species key. TOTAL_WEIGHT of a group is the sum of WEIGHT_KG of all entries in the group. BOAT_COUNT of a group is the number of different boat IDs in the group. The result has one row for each group. The rows are in ascending order of the species key. If no entry remains, the result is empty.
BEST_SPECIES must: build the groups with the same rules as SUMMARIZE. Return the species key of the group with the highest TOTAL_WEIGHT. If two groups have the same highest TOTAL_WEIGHT, return the species key that is first in ascending order. If there is no group, return an empty value.