Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

@@ -0,0 +1,104 @@
CLASS {{p}}tailor_pricer DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
TYPES ty_garment TYPE c LENGTH 10.
TYPES ty_service TYPE c LENGTH 10.
TYPES ty_price TYPE p LENGTH 8 DECIMALS 2.
METHODS calculate_price
IMPORTING iv_garment TYPE ty_garment
iv_service TYPE ty_service
iv_quantity TYPE i
iv_express TYPE abap_bool
RETURNING VALUE(rv_price) TYPE ty_price.
ENDCLASS.
CLASS {{p}}tailor_pricer IMPLEMENTATION.
METHOD calculate_price.
DATA lv_base TYPE ty_price.
DATA lv_factor TYPE ty_price.
DATA lv_total TYPE ty_price.
DATA lv_disc TYPE ty_price.
rv_price = 0.
" a job needs at least one garment
IF iv_quantity > 0.
" base price of the service
IF iv_service = 'HEM'.
lv_base = '8.00'.
ELSEIF iv_service = 'TAKE_IN'.
lv_base = '15.00'.
ELSEIF iv_service = 'ZIP'.
lv_base = '12.00'.
ELSEIF iv_service = 'SLEEVE'.
lv_base = '10.00'.
ELSEIF iv_service = 'LINING'.
lv_base = '25.00'.
ELSE.
lv_base = '0.00'.
ENDIF.
" factor of the garment
IF iv_garment = 'TROUSERS'.
lv_factor = '1.00'.
ELSEIF iv_garment = 'SKIRT'.
lv_factor = '1.00'.
ELSEIF iv_garment = 'JACKET'.
lv_factor = '1.50'.
ELSEIF iv_garment = 'DRESS'.
lv_factor = '1.50'.
ELSEIF iv_garment = 'COAT'.
lv_factor = '2.00'.
ELSE.
lv_factor = '0.00'.
ENDIF.
IF lv_base > '0.00' AND lv_factor > '0.00'.
" price of one garment
lv_total = lv_base * lv_factor.
" express service costs more
IF iv_express = 'X'.
lv_total = lv_total + '6.00'.
ENDIF.
" price of all garments
lv_total = lv_total * iv_quantity.
" discount for many garments
IF iv_quantity >= 5.
lv_disc = '20.00'.
ELSEIF iv_quantity >= 3.
lv_disc = '10.00'.
ELSE.
lv_disc = '0.00'.
ENDIF.
lv_total = lv_total - lv_total * lv_disc / 100.
" the shop has a minimum order value
IF lv_total < '15.00'.
lv_total = '15.00'.
ENDIF.
rv_price = lv_total.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.