1.6 KiB
1.6 KiB
1. Goal
A hair salon prices appointments. The checkout program calls one class for each appointment. The class returns the price of the appointment in euro.
2. Open questions
None.
3. Context
- Interface {{P}}IF_SALON_PRICE exists in package $TMP. It is active.
- The interface has the type TY_SERVICE (CHAR 10) and the type TY_AMOUNT (P length 8, 2 decimals).
- The interface has the constant structure C_SERVICE with the components CUT, COLOUR and PERM.
- The interface has one method: PRICE IMPORTING iv_service TYPE ty_service iv_child TYPE abap_bool RETURNING VALUE(rv_price) TYPE ty_amount.
- iv_child is abap_true when the customer is under 12 years.
4. Contract
- Create the class {{P}}SALON_PRICER in package $TMP.
- The class is public, final, and has a public constructor without parameters.
- The class implements {{P}}IF_SALON_PRICE.
- Do not add other public methods.
5. Business rules
- The price is in euro with two decimals.
- A cut costs 42.00 EUR.
- A colour service costs 78.00 EUR. A colour service includes a scalp treatment. Add 12.00 EUR to the price of a colour service.
- A perm costs 95.00 EUR.
- A cut for a child under 12 years costs exactly 12.00 EUR.
- The minimum price of an appointment is 20.00 EUR.
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_SALON_PRICE.
7. Acceptance
- The class is active and has no syntax error.
- Write your own ABAP Unit tests for the class.