Fix coverage with several contract classes; table annotation and file path checks; clean task dir on write
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
71
tasks_gen/eval/G0102/spec.md
Normal file
71
tasks_gen/eval/G0102/spec.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# 1. Goal
|
||||
Calculate the price of a hotel stay. A booking program calls the calculation
|
||||
before it shows the price to the guest. The program needs one reason code for
|
||||
each invalid input.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- The interface {{P}}IF_HOTEL_RATE exists in package $TMP. It is active.
|
||||
- The interface has these types:
|
||||
- TY_CATEGORY: character, length 1.
|
||||
- TY_REASON: character, length 10.
|
||||
- TY_AMOUNT: packed number, length 10, 2 decimals.
|
||||
- TY_RESULT: structure with the components REASON (TY_REASON) and
|
||||
PRICE (TY_AMOUNT).
|
||||
- The interface has these constants:
|
||||
- C_REASON: OK, NIGHTS, GUESTS, CATEGORY.
|
||||
- C_CATEGORY: BASIC 'S', COMFORT 'C', SUITE 'U'.
|
||||
- The interface has one method:
|
||||
CALCULATE
|
||||
IMPORTING iv_category TYPE ty_category
|
||||
iv_nights TYPE i
|
||||
iv_guests TYPE i
|
||||
iv_breakfast TYPE abap_bool
|
||||
RETURNING VALUE(rs_result) TYPE ty_result.
|
||||
|
||||
# 4. Contract
|
||||
- Create the class {{P}}HOTEL_RATE in package $TMP.
|
||||
- The class is public, final, and has a public constructor without parameters.
|
||||
- The class implements {{P}}IF_HOTEL_RATE.
|
||||
- Do not add other public methods.
|
||||
|
||||
# 5. Business rules
|
||||
Check the input in this sequence. Return the reason of the first check that
|
||||
fails and the price 0.
|
||||
1. If IV_NIGHTS is less than 1, return NIGHTS.
|
||||
2. If IV_GUESTS is less than 1, return GUESTS.
|
||||
3. If IV_CATEGORY is not BASIC, COMFORT or SUITE, return CATEGORY.
|
||||
4. Else return OK and calculate the price.
|
||||
|
||||
Calculate the price in this sequence:
|
||||
1. One room takes at most 2 guests. The number of rooms is the number of guests
|
||||
divided by 2, rounded up.
|
||||
2. The price of one room for one night is 90.00 for BASIC, 140.00 for COMFORT
|
||||
and 260.00 for SUITE.
|
||||
3. The room total is the number of rooms multiplied by the number of nights
|
||||
multiplied by the price of one room for one night.
|
||||
4. Long stay discount on the room total:
|
||||
- 28 nights or more: 20 %
|
||||
- 14 nights or more: 15 %
|
||||
- 7 nights or more: 10 %
|
||||
- less than 7 nights: no discount
|
||||
The discounted room total is the room total minus the discount.
|
||||
5. Breakfast costs 12.50 for one guest for one night. Add it if IV_BREAKFAST is
|
||||
true.
|
||||
6. City tax costs 3.00 for one guest for one night. Add it always.
|
||||
7. The price is the discounted room total plus breakfast plus city tax.
|
||||
|
||||
All amounts are exact to two decimals.
|
||||
|
||||
# 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_HOTEL_RATE.
|
||||
|
||||
# 7. Acceptance
|
||||
- The class is active and has no syntax error.
|
||||
- The hidden tests pass.
|
||||
- Write your own ABAP Unit tests for the class.
|
||||
Reference in New Issue
Block a user