Files

1.5 KiB

1. Goal

A go-kart track charges a fee for each race. A booking program calls one function module for each completed race. The function module calculates the fee from the number of laps, the driver age, and the membership status.

2. Open questions

None.

3. Context

  • Function group {{P}}FG_KART exists in package $TMP.
  • Function module {{P}}KART_SAMPLE exists in this group. It shows the interface style that the booking program uses. Do not change it.

4. Contract

  • Create the function module {{P}}KART_FEE in function group {{P}}FG_KART.
  • Use exactly this interface:
    • Importing parameters: iv_laps TYPE i, iv_driver_age TYPE i, iv_member TYPE abap_bool
    • Exporting parameter: ev_discount TYPE abap_bool
    • Changing parameter: cv_fee TYPE decfloat34
    • Exception: invalid_laps

5. Business rules

  1. If iv_laps is less than 1, raise the exception INVALID_LAPS.
  2. The base fee is 1.50 per lap.
  3. For a driver under 18 years, the fee is exactly 15.00.
  4. For a driver of 18 years or more who is a member, reduce the fee by 10 % and set ev_discount to true.
  5. The minimum fee is 20.00.
  6. Round the fee half up to 2 decimals.
  7. Set ev_discount to false, except in rule 4.

6. Constraints

  • Release target: 8.16.
  • Package: $TMP.
  • Out of scope: do not change {{P}}KART_SAMPLE.
  • Write ABAP Unit tests for the function module in a global test class.

7. Acceptance

  • The function module is active and has no syntax error.
  • The hidden tests pass.
  • The global test class for the function module passes.