Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
74
tasks_gen/train/G1076/reference/claim_checker.clas.abap
Normal file
74
tasks_gen/train/G1076/reference/claim_checker.clas.abap
Normal file
@@ -0,0 +1,74 @@
|
||||
CLASS {{p}}claim_checker DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
TYPES:
|
||||
ty_policy_id TYPE c LENGTH 10,
|
||||
ty_amount TYPE p LENGTH 8 DECIMALS 2,
|
||||
BEGIN OF ty_claim,
|
||||
policy_id TYPE ty_policy_id,
|
||||
vehicle_age TYPE i,
|
||||
damage TYPE ty_amount,
|
||||
deductible TYPE ty_amount,
|
||||
report_days TYPE i,
|
||||
photo_count TYPE i,
|
||||
END OF ty_claim.
|
||||
|
||||
CONSTANTS c_max_payout TYPE ty_amount VALUE '10000.00'.
|
||||
|
||||
METHODS check_claim
|
||||
IMPORTING is_claim TYPE ty_claim
|
||||
RETURNING VALUE(rv_payout) TYPE ty_amount
|
||||
RAISING {{p}}cx_claim_error.
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS validate
|
||||
IMPORTING is_claim TYPE ty_claim
|
||||
RAISING {{p}}cx_claim_error.
|
||||
|
||||
METHODS raise_error
|
||||
IMPORTING iv_reason TYPE {{p}}cx_claim_error=>ty_reason
|
||||
RAISING {{p}}cx_claim_error.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}claim_checker IMPLEMENTATION.
|
||||
METHOD check_claim.
|
||||
validate( is_claim ).
|
||||
rv_payout = is_claim-damage - is_claim-deductible.
|
||||
IF rv_payout > c_max_payout.
|
||||
rv_payout = c_max_payout.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD validate.
|
||||
IF substring( val = is_claim-policy_id len = 1 ) <> 'P'
|
||||
OR substring( val = is_claim-policy_id off = 1 ) CN '0123456789'.
|
||||
raise_error( 'POLICY' ).
|
||||
ENDIF.
|
||||
|
||||
IF is_claim-report_days < 0 OR is_claim-report_days > 14.
|
||||
raise_error( 'LATE' ).
|
||||
ENDIF.
|
||||
|
||||
IF is_claim-vehicle_age < 0 OR is_claim-vehicle_age > 12.
|
||||
raise_error( 'AGED' ).
|
||||
ENDIF.
|
||||
|
||||
IF is_claim-photo_count < 2.
|
||||
raise_error( 'PHOTOS' ).
|
||||
ENDIF.
|
||||
|
||||
IF is_claim-damage <= 0.
|
||||
raise_error( 'DAMAGE' ).
|
||||
ENDIF.
|
||||
|
||||
IF is_claim-deductible < 0 OR is_claim-deductible > is_claim-damage.
|
||||
raise_error( 'DEDUCT' ).
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD raise_error.
|
||||
RAISE EXCEPTION TYPE {{p}}cx_claim_error
|
||||
EXPORTING
|
||||
iv_reason = iv_reason.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user