48 lines
2.1 KiB
Markdown
48 lines
2.1 KiB
Markdown
# 1. Goal
|
|
A tattoo studio prices tattoo projects. The reception desk calls one function
|
|
module for each project. The function module calculates the studio fee.
|
|
The function module must use the same interface as the sample pricing module,
|
|
because the reception desk calls all pricing modules in the same way.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_TATTOO exists in package $TMP.
|
|
- Function module {{P}}TATTOO_SAMPLE exists in this group. It is the sample
|
|
pricing module. Its interface is the interface that every pricing module must
|
|
use. Read the interface of {{P}}TATTOO_SAMPLE before you write code.
|
|
- A project has a style code and a number of sessions. A project has one
|
|
session or many sessions.
|
|
|
|
# 4. Contract
|
|
- Create the function module {{P}}TATTOO_FEE in function group {{P}}FG_TATTOO.
|
|
- Use exactly the interface of {{P}}TATTOO_SAMPLE: the same parameter names,
|
|
the same parameter kinds, the same types, and the same exceptions.
|
|
|
|
# 5. Business rules
|
|
1. If the number of sessions is less than 1, raise the exception
|
|
INVALID_SESSIONS. The sample module declares this exception.
|
|
2. Set the deposit flag to false, except in rule 6.
|
|
3. Style code LINE: the first session costs 133.33. Every further session
|
|
costs half of 133.33, rounded half up to 2 decimals. The fee is the sum of
|
|
the first session and all further sessions. Then apply the minimum fee
|
|
150.00 and the maximum fee 800.00.
|
|
4. Style code SHADE: the first session costs 97.77. Every further session
|
|
costs half of 97.77, rounded half up to 2 decimals. The fee is the sum of
|
|
the first session and all further sessions. Then apply the minimum fee
|
|
110.00 and the maximum fee 600.00.
|
|
5. Other style codes: the fee is 0.
|
|
6. If the number of sessions is greater than 6, set the deposit flag to true.
|
|
This rule applies to every style code. The fee does not change.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Use Clean ABAP. Keep the code short and readable.
|
|
- Out of scope: do not change {{P}}TATTOO_SAMPLE.
|
|
|
|
# 7. Acceptance
|
|
- The function module is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|