Files
abap-llm/tasks_gen/eval/G0168/spec.md

49 lines
1.8 KiB
Markdown

# 1. Goal
Calculate the discount percentage for a wholesale order. A sales program calls the
calculation before it prices the order. The program needs one discount percentage
for each order.
# 2. Open questions
None.
# 3. Context
- The interface {{P}}IF_DISCOUNT exists in package $TMP. It is active.
- The interface has the type TY_GROUP (CHAR 1), the type TY_PERCENT (P length 5
with 2 decimals), the constants C_GROUP_KEY ('A') and C_GROUP_STANDARD ('S'),
and one method:
CALCULATE IMPORTING iv_quantity TYPE i
iv_group TYPE ty_group
RETURNING VALUE(rv_percent) TYPE ty_percent.
# 4. Contract
- Create the class {{P}}VOLUME_DISCOUNT in package $TMP.
- The class is public, final, and has a public constructor without parameters.
- The class implements {{P}}IF_DISCOUNT.
- Do not add other public methods.
# 5. Business rules
The discount percentage is the sum of the customer discount and the volume
discount. The result is at most 12.00.
1. Customer discount:
- Group C_GROUP_KEY: 6.00.
- Group C_GROUP_STANDARD: 0.00.
- Any other group: 0.00.
2. Volume discount. The order quantity is the number of pieces:
- Less than 100 pieces: 0.00.
- More than 100 pieces and less than 500 pieces: 3.00.
- 500 pieces or more: 7.00.
3. Add the customer discount and the volume discount. If the sum is more than
12.00, the result is 12.00.
# 6. Constraints
- Release target: 8.16.
- Coding standards: Clean ABAP. Method length below 40 statements. No global
variables. No comment that restates the code.
- Out of scope: do not change {{P}}IF_DISCOUNT.
- If a business rule is missing or two business rules contradict, do not create
the object. Report the gap.
# 7. Acceptance
- The class is active and has no syntax error.
- Write your own ABAP Unit tests for the class.