Files
abap-llm/tasks_gen/eval/G0171/spec.md

55 lines
2.2 KiB
Markdown

# 1. Goal
Calculate the price of one firing in a pottery kiln. The kiln booking program calls
the calculation before it confirms a booking. The program needs one price for each
booking.
# 2. Open questions
None.
# 3. Context
- The interface {{P}}IF_KILN_PRICE exists in package $TMP. It is active.
- The interface has the types TY_CLAY (2 characters), TY_WEIGHT (packed, length 6,
decimals 2) and TY_PRICE (packed, length 8, decimals 2).
- The interface has one method:
CALCULATE_PRICE
IMPORTING iv_pieces TYPE i
iv_weight TYPE ty_weight
iv_clay TYPE ty_clay
iv_glaze TYPE abap_bool
iv_member TYPE abap_bool
RETURNING VALUE(rv_price) TYPE ty_price.
iv_pieces is the number of pieces. iv_weight is the weight in kilograms.
iv_glaze is 'X' when the customer books a glaze firing. iv_member is 'X' when
the customer is a member.
- The kiln booking program calls the method for each booking. The customer can
leave the clay type empty when the booking is created. The customer chooses the
clay type later.
# 4. Contract
- Create the class {{P}}KILN_PRICER in package $TMP.
- The class is public, final, and has a public constructor without parameters.
- The class implements {{P}}IF_KILN_PRICE.
- Do not add other public methods.
# 5. Business rules
The price is in euro. Apply the rules in this sequence.
1. Base fee: 40.00 for each firing.
2. Piece fee: 12.00 for each piece.
3. Weight surcharge: 3.00 for each kilogram of the weight that is above 10 kg.
A weight of 10 kg or less gives no surcharge.
4. Clay factor: multiply the sum of rules 1 to 3 by the factor of the chosen clay
type: EA 1.00, ST 1.20, PO 1.50.
5. Glaze firing: add 25.00 when the customer books a glaze firing.
6. Member discount: subtract 15 per cent when the customer is a member.
7. Round the result to two decimals. Round half up.
# 6. Constraints
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
- 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_KILN_PRICE.
# 7. Acceptance
- The class is active and has no syntax error.
- Write your own ABAP Unit tests for the class.