H and K tested (G0168, G0178 accepted); keyword fast path needs all groups
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
50
tasks_gen/eval/G0168/reference/volume_discount.clas.abap
Normal file
50
tasks_gen/eval/G0168/reference/volume_discount.clas.abap
Normal file
@@ -0,0 +1,50 @@
|
||||
CLASS {{p}}volume_discount DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_discount.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CONSTANTS:
|
||||
c_max_discount TYPE {{p}}if_discount=>ty_percent VALUE '12.00',
|
||||
c_key_discount TYPE {{p}}if_discount=>ty_percent VALUE '6.00',
|
||||
c_mid_discount TYPE {{p}}if_discount=>ty_percent VALUE '3.00',
|
||||
c_high_discount TYPE {{p}}if_discount=>ty_percent VALUE '7.00',
|
||||
c_no_discount TYPE {{p}}if_discount=>ty_percent VALUE '0.00',
|
||||
c_mid_limit TYPE i VALUE 100,
|
||||
c_high_limit TYPE i VALUE 500.
|
||||
|
||||
METHODS customer_discount
|
||||
IMPORTING iv_group TYPE {{p}}if_discount=>ty_group
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_discount=>ty_percent.
|
||||
|
||||
METHODS volume_discount
|
||||
IMPORTING iv_quantity TYPE i
|
||||
RETURNING VALUE(rv_percent) TYPE {{p}}if_discount=>ty_percent.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}volume_discount IMPLEMENTATION.
|
||||
METHOD {{p}}if_discount~calculate.
|
||||
rv_percent = customer_discount( iv_group ) + volume_discount( iv_quantity ).
|
||||
IF rv_percent > c_max_discount.
|
||||
rv_percent = c_max_discount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD customer_discount.
|
||||
IF iv_group = {{p}}if_discount=>c_group_key.
|
||||
rv_percent = c_key_discount.
|
||||
ELSE.
|
||||
rv_percent = c_no_discount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD volume_discount.
|
||||
IF iv_quantity < c_mid_limit.
|
||||
rv_percent = c_no_discount.
|
||||
ELSEIF iv_quantity < c_high_limit.
|
||||
rv_percent = c_mid_discount.
|
||||
ELSE.
|
||||
rv_percent = c_high_discount.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user