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,58 @@
# 1. Goal
Check a car damage claim of an insurance company before the company pays it.
The claims program calls the check for each claim. The check returns the payout
amount or it stops with a reason.
# 2. Open questions
None.
# 3. Context
- The exception class {{P}}CX_CLAIM_ERROR exists in package $TMP. It is active.
- The class inherits from CX_STATIC_CHECK.
- The class has the public type TY_REASON (CHAR 12) and the read-only attribute
MV_REASON of type TY_REASON.
- The constructor of the class has the importing parameter IV_REASON of type
TY_REASON.
- The class redefines GET_TEXT. The text of the exception contains the reason.
# 4. Contract
- Create the class {{P}}CLAIM_CHECKER in package $TMP.
- The class is public, final, and has a public constructor without parameters.
- Public types of the class:
- TY_POLICY_ID TYPE c LENGTH 10.
- TY_AMOUNT TYPE p LENGTH 8 DECIMALS 2.
- TY_CLAIM, a structure with the components POLICY_ID (type TY_POLICY_ID),
VEHICLE_AGE (type i), DAMAGE (type TY_AMOUNT), DEDUCTIBLE (type TY_AMOUNT),
REPORT_DAYS (type i) and PHOTO_COUNT (type i).
- The public constant C_MAX_PAYOUT TYPE TY_AMOUNT has the value 10000.00.
- One public method:
CHECK_CLAIM
IMPORTING is_claim TYPE ty_claim
RETURNING VALUE(rv_payout) TYPE ty_amount
RAISING {{P}}CX_CLAIM_ERROR.
- Do not add other public methods.
# 5. Business rules
Apply the rules in this sequence. Raise the exception {{P}}CX_CLAIM_ERROR with
the reason of the first rule that fails. The reason is the text that the rule
shows.
1. The policy ID must start with the letter P. The other 9 characters must be
digits. Else raise the reason 'POLICY'.
2. REPORT_DAYS must be between 0 and 14. Else raise the reason 'LATE'.
3. VEHICLE_AGE must be between 0 and 12. Else raise the reason 'AGED'.
4. PHOTO_COUNT must be at least 2. Else raise the reason 'PHOTOS'.
5. DAMAGE must be greater than 0. Else raise the reason 'DAMAGE'.
6. DEDUCTIBLE must be between 0 and DAMAGE. Else raise the reason 'DEDUCT'.
7. The payout is DAMAGE minus DEDUCTIBLE.
8. If the payout is greater than C_MAX_PAYOUT, the payout is C_MAX_PAYOUT.
# 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}}CX_CLAIM_ERROR.
# 7. Acceptance
- The class is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the class.