1.8 KiB
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
- The lane fee is 12.00 EUR for each lane and each hour.
- The shoe rental is 2.50 EUR for each pair of shoes.
- A booking of more than 4 lanes is a group booking.
- A booking of more than 3 hours is a large booking.
- A group booking gets a discount of 10 % on the lane fee.
- A large booking gets a discount of 20 % on the lane fee.
- A booking gets exactly one discount.
- The shoe rental is never discounted.
- If the number of lanes is zero or less, or if the number of hours is zero or less, the lane fee is zero.
- If the number of pairs of shoes is zero or less, the shoe rental is zero.
- 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.