Files

50 lines
2.2 KiB
Markdown

# 1. Goal
Fix the class {{P}}LAUNDRY_PRICER. A laundry service uses the class to calculate the price of a laundry order. Users report three defects:
- A member pays the wrong price for a small order.
- A member gets a discount on the express surcharge.
- Ironing is much too expensive.
The class must calculate the correct price for every order.
# 2. Open questions
None.
# 3. Context
- The class {{P}}LAUNDRY_PRICER exists in package $TMP. It is active.
- The class is public and final. It has a public method CALCULATE with the
importing parameters iv_weight_kg, iv_service, iv_express, iv_member and the
returning parameter rv_price.
- The class has the public types ty_weight_kg, ty_amount and ty_service and the
public constants c_service_wash, c_service_dry and c_service_iron.
- The class has the private methods rate_per_kg and round_currency.
- A laundry order has a weight in kg, a service, an express flag and a member
flag. The services are WASH, DRY and IRON.
# 4. Contract
- Fix the class {{P}}LAUNDRY_PRICER in place.
- Do not change the public method signature, the public types or the public
constants.
- Do not add other public methods.
# 5. Business rules
Apply the rules in this sequence. All other behavior stays the same.
1. The base price is the weight multiplied by the rate per kg. A member gets a
discount of 10 percent on the base price. An express order costs a fixed
surcharge of 5.00. The member discount does not apply to the express
surcharge. Add the express surcharge after the member discount.
2. The minimum order value is 10.00. Apply the minimum after all discounts and
surcharges. If the price after all discounts and surcharges is below 10.00,
the price is 10.00.
3. The ironing service uses its own rate. The rate for ironing is 1.50 per kg.
# 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 the public method signature, the public types or
the public constants.
# 7. Acceptance
- The class is active and has no syntax error.
- The hidden tests pass.
- Write your own ABAP Unit tests for the class.