Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
31
tasks_gen/train/G1067/generation.json
Normal file
31
tasks_gen/train/G1067/generation.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"id": "G1067",
|
||||
"pool": "train",
|
||||
"object_type": "CLAS",
|
||||
"category": "H",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"seed/boattyp.tabl.abap: a table needs the annotation @AbapCatalog.tableCategory (for example #TRANSPARENT, #A)",
|
||||
"seed/boattyp.tabl.abap: a table needs the annotation @AbapCatalog.deliveryClass (for example #TRANSPARENT, #A)",
|
||||
"Too close to task G0150 (similarity spec 0.64, rules 0.61, names 0.50). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"static": 2,
|
||||
"extra": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": null,
|
||||
"null": null
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 100,
|
||||
"null": 30
|
||||
}
|
||||
],
|
||||
"accepted": true
|
||||
}
|
||||
69
tasks_gen/train/G1067/reference/tent_hire_fee.clas.abap
Normal file
69
tasks_gen/train/G1067/reference/tent_hire_fee.clas.abap
Normal file
@@ -0,0 +1,69 @@
|
||||
CLASS {{p}}tent_hire_fee DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES {{p}}if_tent_hire.
|
||||
PRIVATE SECTION.
|
||||
TYPES ty_calc TYPE p LENGTH 15 DECIMALS 4.
|
||||
|
||||
METHODS get_rates
|
||||
IMPORTING iv_tent_size TYPE string
|
||||
EXPORTING ev_rate_day TYPE {{p}}if_tent_hire=>ty_amount
|
||||
ev_setup_fee TYPE {{p}}if_tent_hire=>ty_amount
|
||||
ev_found TYPE abap_bool.
|
||||
METHODS apply_discount
|
||||
IMPORTING iv_days TYPE i
|
||||
CHANGING cv_amount TYPE ty_calc.
|
||||
METHODS round_gross
|
||||
IMPORTING iv_amount TYPE ty_calc
|
||||
RETURNING VALUE(rv_fee) TYPE {{p}}if_tent_hire=>ty_amount.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}tent_hire_fee IMPLEMENTATION.
|
||||
METHOD {{p}}if_tent_hire~calculate_fee.
|
||||
DATA lv_rate_day TYPE {{p}}if_tent_hire=>ty_amount.
|
||||
DATA lv_setup_fee TYPE {{p}}if_tent_hire=>ty_amount.
|
||||
DATA lv_found TYPE abap_bool.
|
||||
get_rates(
|
||||
EXPORTING iv_tent_size = iv_tent_size
|
||||
IMPORTING ev_rate_day = lv_rate_day
|
||||
ev_setup_fee = lv_setup_fee
|
||||
ev_found = lv_found ).
|
||||
IF lv_found = abap_false.
|
||||
rv_fee = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
DATA lv_net TYPE ty_calc.
|
||||
lv_net = iv_days * lv_rate_day + lv_setup_fee.
|
||||
apply_discount( EXPORTING iv_days = iv_days CHANGING cv_amount = lv_net ).
|
||||
DATA(lv_gross) = lv_net * ( 1 + {{p}}if_tent_hire=>c_vat ).
|
||||
rv_fee = round_gross( lv_gross ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_rates.
|
||||
CASE to_upper( iv_tent_size ).
|
||||
WHEN 'S'.
|
||||
ev_rate_day = {{p}}if_tent_hire=>c_rate_s-rate_day.
|
||||
ev_setup_fee = {{p}}if_tent_hire=>c_rate_s-setup_fee.
|
||||
WHEN 'M'.
|
||||
ev_rate_day = {{p}}if_tent_hire=>c_rate_m-rate_day.
|
||||
ev_setup_fee = {{p}}if_tent_hire=>c_rate_m-setup_fee.
|
||||
WHEN 'L'.
|
||||
ev_rate_day = {{p}}if_tent_hire=>c_rate_l-rate_day.
|
||||
ev_setup_fee = {{p}}if_tent_hire=>c_rate_l-setup_fee.
|
||||
WHEN OTHERS.
|
||||
ev_found = abap_false.
|
||||
RETURN.
|
||||
ENDCASE.
|
||||
ev_found = abap_true.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD apply_discount.
|
||||
IF iv_days >= {{p}}if_tent_hire=>c_long_rental_days.
|
||||
cv_amount = cv_amount * ( 1 - {{p}}if_tent_hire=>c_discount ).
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD round_gross.
|
||||
rv_fee = round( val = iv_amount dec = 2 ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
@@ -0,0 +1,51 @@
|
||||
CLASS ltc_tent_hire_fee DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
DATA mo_cut TYPE REF TO {{p}}if_tent_hire.
|
||||
METHODS setup.
|
||||
METHODS small_tent_one_day FOR TESTING.
|
||||
METHODS small_tent_five_days FOR TESTING.
|
||||
METHODS medium_tent_three_days FOR TESTING.
|
||||
METHODS large_tent_seven_days FOR TESTING.
|
||||
METHODS unknown_size FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_tent_hire_fee IMPLEMENTATION.
|
||||
METHOD setup.
|
||||
mo_cut = NEW {{p}}tent_hire_fee( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD small_tent_one_day.
|
||||
" 1 * 45.00 + 30.00 = 75.00; plus 19% VAT = 89.25
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = '89.25'
|
||||
act = mo_cut->calculate_fee( iv_tent_size = 'S' iv_days = 1 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD small_tent_five_days.
|
||||
" 5 * 45.00 + 30.00 = 255.00; less 10% = 229.50; plus 19% VAT = 273.105
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = '273.11'
|
||||
act = mo_cut->calculate_fee( iv_tent_size = 'S' iv_days = 5 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD medium_tent_three_days.
|
||||
" 3 * 68.00 + 40.00 = 244.00; plus 19% VAT = 290.36
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = '290.36'
|
||||
act = mo_cut->calculate_fee( iv_tent_size = 'M' iv_days = 3 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD large_tent_seven_days.
|
||||
" 7 * 95.00 + 55.00 = 720.00; less 10% = 648.00; plus 19% VAT = 771.12
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = '771.12'
|
||||
act = mo_cut->calculate_fee( iv_tent_size = 'L' iv_days = 7 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD unknown_size.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
exp = '0.00'
|
||||
act = mo_cut->calculate_fee( iv_tent_size = 'X' iv_days = 2 ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
25
tasks_gen/train/G1067/seed/if_tent_hire.intf.abap
Normal file
25
tasks_gen/train/G1067/seed/if_tent_hire.intf.abap
Normal file
@@ -0,0 +1,25 @@
|
||||
INTERFACE {{p}}if_tent_hire PUBLIC.
|
||||
TYPES ty_amount TYPE p LENGTH 15 DECIMALS 2.
|
||||
|
||||
CONSTANTS:
|
||||
BEGIN OF c_rate_s,
|
||||
rate_day TYPE ty_amount VALUE '45.00',
|
||||
setup_fee TYPE ty_amount VALUE '30.00',
|
||||
END OF c_rate_s,
|
||||
BEGIN OF c_rate_m,
|
||||
rate_day TYPE ty_amount VALUE '68.00',
|
||||
setup_fee TYPE ty_amount VALUE '40.00',
|
||||
END OF c_rate_m,
|
||||
BEGIN OF c_rate_l,
|
||||
rate_day TYPE ty_amount VALUE '95.00',
|
||||
setup_fee TYPE ty_amount VALUE '55.00',
|
||||
END OF c_rate_l,
|
||||
c_vat TYPE ty_amount VALUE '0.19',
|
||||
c_discount TYPE ty_amount VALUE '0.10',
|
||||
c_long_rental_days TYPE i VALUE 5.
|
||||
|
||||
METHODS calculate_fee
|
||||
IMPORTING iv_tent_size TYPE string
|
||||
iv_days TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
ENDINTERFACE.
|
||||
49
tasks_gen/train/G1067/spec.md
Normal file
49
tasks_gen/train/G1067/spec.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# 1. Goal
|
||||
Calculate the fee of hiring a marquee tent for an event. A booking program
|
||||
calls the calculation before it confirms a booking. The program needs the
|
||||
gross price in euro.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Interface {{P}}IF_TENT_HIRE exists in package $TMP. It is active.
|
||||
- The interface has the type TY_AMOUNT (P LENGTH 15 DECIMALS 2), the constant
|
||||
structures C_RATE_S, C_RATE_M and C_RATE_L, the constants C_VAT,
|
||||
C_DISCOUNT and C_LONG_RENTAL_DAYS, and one method:
|
||||
CALCULATE_FEE IMPORTING iv_tent_size TYPE string
|
||||
iv_days TYPE i
|
||||
RETURNING VALUE(rv_fee) TYPE ty_amount.
|
||||
- Each rate structure has the components RATE_DAY and SETUP_FEE.
|
||||
C_RATE_S belongs to tent size S, C_RATE_M to tent size M and C_RATE_L to
|
||||
tent size L.
|
||||
- C_VAT is the value added tax rate. C_DISCOUNT is the discount rate.
|
||||
C_LONG_RENTAL_DAYS is the number of days from which the discount applies.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}TENT_HIRE_FEE in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_TENT_HIRE.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
Apply the rules in this sequence.
|
||||
1. Read the daily rate and the setup fee for the tent size. Tent size S uses
|
||||
C_RATE_S, tent size M uses C_RATE_M and tent size L uses C_RATE_L. If the
|
||||
tent size is not S, M or L, return 0.
|
||||
2. The net price is the number of days multiplied by the daily rate plus the
|
||||
setup fee.
|
||||
3. If the number of days is C_LONG_RENTAL_DAYS or more, reduce the net price by
|
||||
C_DISCOUNT.
|
||||
4. Add value added tax of C_VAT to the net price. The result is the gross price
|
||||
in euro. The gross price must have two decimal places.
|
||||
|
||||
# 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}}IF_TENT_HIRE.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
64
tasks_gen/train/G1067/task.json
Normal file
64
tasks_gen/train/G1067/task.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"id": "G1067",
|
||||
"category": "H",
|
||||
"object_type": "CLAS",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "stop",
|
||||
"expected_gap": {
|
||||
"description": "The spec does not define the rounding rule that turns the gross price into an amount with two decimal places.",
|
||||
"keywords": [
|
||||
[
|
||||
"rounding",
|
||||
"rule"
|
||||
],
|
||||
[
|
||||
"round",
|
||||
"cent"
|
||||
],
|
||||
[
|
||||
"round",
|
||||
"decimal"
|
||||
],
|
||||
[
|
||||
"how",
|
||||
"round"
|
||||
]
|
||||
]
|
||||
},
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "INTF",
|
||||
"name": "{{P}}IF_TENT_HIRE",
|
||||
"file": "seed/if_tent_hire.intf.abap",
|
||||
"description": "Marquee tent hire interface with rates"
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}TENT_HIRE_FEE",
|
||||
"implements": "{{P}}IF_TENT_HIRE"
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}IF_TENT_HIRE"
|
||||
],
|
||||
"hidden_tests": [],
|
||||
"reference": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}TENT_HIRE_FEE",
|
||||
"file": "reference/tent_hire_fee.clas.abap",
|
||||
"description": "Marquee tent hire fee calculation",
|
||||
"testclasses_file": "reference/tent_hire_fee.testclasses.abap"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user