- generator: budget floor (2x oracle activations, 3x calls), static checks for CDS $parameters and UNION annotation - harness/mutation.py: deterministic mutants of the reference; hidden tests must fail - G0022 revalidated with harness fixes: oracle 100, null 0 - results in docs/faz1-tasarim.md 11f Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
82 lines
3.4 KiB
Markdown
82 lines
3.4 KiB
Markdown
# 1. Goal
|
|
Calculate the price of a finished car-sharing rental. A booking program calls
|
|
one function module for each finished rental. The function module must have
|
|
the same interface as the sample function module, because the booking program
|
|
calls all pricing modules in the same way.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_RENT exists in package $TMP.
|
|
- Function module {{P}}RENT_SAMPLE exists in this function group. It is the
|
|
sample pricing module. Its interface is the interface that all pricing
|
|
modules must use.
|
|
- All rental data is in the input parameters. No database access is necessary.
|
|
|
|
# 4. Contract
|
|
Create the function module {{P}}RENT_PRICE in function group {{P}}FG_RENT.
|
|
The interface is:
|
|
|
|
IMPORTING
|
|
iv_vehicle_class TYPE string
|
|
iv_minutes TYPE i
|
|
iv_km TYPE i
|
|
iv_member TYPE abap_bool
|
|
iv_weekend TYPE abap_bool
|
|
EXPORTING
|
|
ev_time_fee TYPE decfloat34
|
|
ev_distance_fee TYPE decfloat34
|
|
ev_surcharge TYPE decfloat34
|
|
ev_discount TYPE decfloat34
|
|
ev_total TYPE decfloat34
|
|
EXCEPTIONS
|
|
invalid_duration
|
|
invalid_distance
|
|
invalid_class
|
|
|
|
This interface is the same as the interface of {{P}}RENT_SAMPLE.
|
|
|
|
Put the calculation logic in a new class in package $TMP. The function module
|
|
must only call this class. The function module must not contain the
|
|
calculation itself. The class is your own design decision. The function module
|
|
maps the result of the class to its exporting parameters and exceptions.
|
|
|
|
# 5. Business rules
|
|
1. Check the input in this sequence:
|
|
a. If iv_minutes is less than 1, raise INVALID_DURATION.
|
|
b. If iv_km is less than 0, raise INVALID_DISTANCE.
|
|
c. If iv_vehicle_class is not 'S', not 'M' and not 'L', raise INVALID_CLASS.
|
|
2. Charge the rental duration in started 15-minute blocks. A duration of 15
|
|
minutes is one block. A duration of 16 minutes is two blocks.
|
|
3. The price of one block depends on the vehicle class: 'S' costs 3.00, 'M'
|
|
costs 5.00 and 'L' costs 8.00. The time fee is the number of blocks
|
|
multiplied by the block price.
|
|
4. The first 10 kilometres of a rental are free. Each further kilometre costs
|
|
0.25. The distance fee is the number of kilometres above 10 multiplied by
|
|
0.25.
|
|
5. If iv_weekend is true, the weekend surcharge is 25 % of the time fee.
|
|
Otherwise the weekend surcharge is 0.
|
|
6. The gross amount is the time fee plus the distance fee plus the weekend
|
|
surcharge.
|
|
7. If iv_member is true, the member discount is 15 % of the gross amount.
|
|
Otherwise the member discount is 0.
|
|
8. The total price is the gross amount minus the member discount. If this
|
|
value is less than 5.00, the total price is 5.00.
|
|
9. Round the weekend surcharge, the member discount and the total price half
|
|
up to 2 decimals.
|
|
10. Return the time fee in ev_time_fee, the distance fee in ev_distance_fee,
|
|
the weekend surcharge in ev_surcharge, the member discount in ev_discount
|
|
and the total price in ev_total.
|
|
|
|
# 6. Constraints
|
|
- Release target: ABAP Platform 2025 (SAP_BASIS 816).
|
|
- Coding standards: Clean ABAP. Keep every method below 40 statements.
|
|
- Out of scope: do not change {{P}}RENT_SAMPLE.
|
|
|
|
# 7. Acceptance
|
|
- The function module {{P}}RENT_PRICE is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the new class as local test classes.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|