Files
abap-llm/tasks_gen/train/G1019/spec.md

1.8 KiB

1. Goal

Calculate the fee of a bowling lane booking. A checkout program calls the calculation before it takes the payment. The program needs one fee for each booking.

2. Open questions

None.

3. Context

  • The interface {{P}}IF_BOWLING_FEE exists in package $TMP. It is active.
  • The interface has the type TY_FEE (P LENGTH 8 DECIMALS 2) and one method: CALCULATE_FEE IMPORTING iv_lanes TYPE i, iv_hours TYPE i, iv_shoes TYPE i RETURNING VALUE(rv_fee) TYPE ty_fee.
  • The checkout program gives the number of lanes, the number of hours, and the number of pairs of shoes of the booking.

4. Contract

  • Create the class {{P}}BOWLING_FEE in package $TMP.
  • The class is public, final, and has a public constructor without parameters.
  • The class implements {{P}}IF_BOWLING_FEE.
  • Do not add other public methods.

5. Business rules

  1. The lane fee is 12.00 EUR for each lane and each hour.
  2. The shoe rental is 2.50 EUR for each pair of shoes.
  3. A booking of more than 4 lanes is a group booking.
  4. A booking of more than 3 hours is a large booking.
  5. A group booking gets a discount of 10 % on the lane fee.
  6. A large booking gets a discount of 20 % on the lane fee.
  7. A booking gets exactly one discount.
  8. The shoe rental is never discounted.
  9. If the number of lanes is zero or less, or if the number of hours is zero or less, the lane fee is zero.
  10. If the number of pairs of shoes is zero or less, the shoe rental is zero.
  11. The fee is the lane fee after the discount plus the shoe rental.

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_BOWLING_FEE.

7. Acceptance

  • The class is active and has no syntax error.
  • Write your own ABAP Unit tests for the class.