Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
65
tasks_gen/train/G1096/spec.md
Normal file
65
tasks_gen/train/G1096/spec.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# 1. Goal
|
||||
An animal shelter checks an adoption application before it approves the
|
||||
adoption. The shelter office calls one function module for each application.
|
||||
The function module calculates the deposit and the visit day. If the shelter
|
||||
rejects the application, the function module raises a class-based exception.
|
||||
The exception carries the reason of the rejection.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The function group {{P}}FG_SHELTER exists in package $TMP.
|
||||
- The function module {{P}}SHELTER_SAMPLE exists in this group. It is a sample
|
||||
module. Do not change it.
|
||||
- The shelter office calls {{P}}ADOPT_REVIEW for each application.
|
||||
- The shelter office catches the class-based exception {{P}}CX_ADOPT_REJECT
|
||||
and reads the reason of the rejection from the attribute MV_REASON.
|
||||
|
||||
# 4. Contract
|
||||
Create the global exception class {{P}}CX_ADOPT_REJECT in package $TMP.
|
||||
- It inherits from CX_STATIC_CHECK.
|
||||
- It has the public read-only attribute MV_REASON of type STRING.
|
||||
- It has a constructor with the importing parameter IV_REASON of type STRING.
|
||||
The constructor stores the value of IV_REASON in MV_REASON.
|
||||
|
||||
Create the function module {{P}}ADOPT_REVIEW in function group {{P}}FG_SHELTER
|
||||
with this interface:
|
||||
- IMPORTING iv_species TYPE string
|
||||
- IMPORTING iv_age_years TYPE i
|
||||
- IMPORTING iv_housing TYPE string
|
||||
- IMPORTING iv_garden TYPE abap_bool
|
||||
- IMPORTING iv_pets TYPE i
|
||||
- EXPORTING ev_deposit TYPE decfloat34
|
||||
- EXPORTING ev_visit_day TYPE string
|
||||
The function module raises the class-based exception {{P}}CX_ADOPT_REJECT.
|
||||
|
||||
# 5. Business rules
|
||||
1. Check the rules 2 to 5 in this order. Raise the exception with the given
|
||||
reason as soon as one check fails. Do not change EV_DEPOSIT or EV_VISIT_DAY
|
||||
in this case.
|
||||
2. If IV_AGE_YEARS is less than 18, the reason is 'TOO_YOUNG'.
|
||||
3. If IV_SPECIES is not 'DOG', not 'CAT' and not 'RABBIT', the reason is
|
||||
'UNKNOWN_SPECIES'.
|
||||
4. If IV_SPECIES is 'DOG' and IV_HOUSING is 'FLAT' and IV_GARDEN is false, the
|
||||
reason is 'NO_GARDEN'.
|
||||
5. If IV_PETS is greater than 2, the reason is 'TOO_MANY_PETS'.
|
||||
6. The deposit is 150.00 for 'DOG', 80.00 for 'CAT' and 40.00 for 'RABBIT'.
|
||||
7. If IV_PETS is greater than 0, add 12.00 to the deposit.
|
||||
8. The visit day is 'SAT' if IV_GARDEN is true. The visit day is 'WED' if
|
||||
IV_GARDEN is false.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16 (SAP_BASIS 816, ABAP Platform 2025).
|
||||
- Package $TMP. Do not use a transport.
|
||||
- Use class-based exceptions. Do not use classic exceptions. Do not use
|
||||
sy-subrc for the result of a check.
|
||||
- Coding standard: Clean ABAP.
|
||||
- Out of scope: do not change the function group {{P}}FG_SHELTER and the
|
||||
function module {{P}}SHELTER_SAMPLE.
|
||||
|
||||
# 7. Acceptance
|
||||
- The exception class {{P}}CX_ADOPT_REJECT and the function module
|
||||
{{P}}ADOPT_REVIEW are active and have no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
Reference in New Issue
Block a user