Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
73
tasks_gen/train/G1104/spec.md
Normal file
73
tasks_gen/train/G1104/spec.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# 1. Goal
|
||||
A golf club prices a tee time booking. The pro shop calls one function module
|
||||
for each booking before it confirms the booking. The function module rejects an
|
||||
invalid booking with a class-based exception and returns the green fee of a
|
||||
valid booking.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- Function group {{P}}FG_GOLF exists in package $TMP.
|
||||
- The club sells rounds of 9 holes and rounds of 18 holes.
|
||||
- The club has three player categories: members, guests and juniors.
|
||||
- The pro shop calls the function module for each booking.
|
||||
|
||||
# 4. Contract
|
||||
Exception class {{P}}CX_GOLF in package $TMP:
|
||||
- The class is public, final and inherits from CX_STATIC_CHECK.
|
||||
- The class has a public constructor with the importing parameters iv_reason
|
||||
(type string) and iv_message (type string).
|
||||
- The class has the public read-only attributes mv_reason (type string) and
|
||||
mv_message (type string).
|
||||
- The constructor stores iv_reason in mv_reason and iv_message in mv_message.
|
||||
|
||||
Function module {{P}}GOLF_FEE in function group {{P}}FG_GOLF:
|
||||
- Importing parameters:
|
||||
- iv_category type string
|
||||
- iv_holes type i
|
||||
- iv_players type i
|
||||
- iv_tee_hour type i
|
||||
- Exporting parameter:
|
||||
- ev_fee type decfloat34
|
||||
- The function module raises the class-based exception {{P}}CX_GOLF. Declare
|
||||
this exception in the interface of the function module, because the caller
|
||||
handles it with CATCH {{P}}CX_GOLF.
|
||||
- The function module has no classic exceptions.
|
||||
|
||||
# 5. Business rules
|
||||
1. The number of players must be between 1 and 4. If it is not, raise
|
||||
{{P}}CX_GOLF with the reason INVALID_PLAYERS and the message
|
||||
"Number of players must be between 1 and 4".
|
||||
2. The number of holes must be 9 or 18. If it is not, raise {{P}}CX_GOLF with
|
||||
the reason INVALID_HOLES and the message "Number of holes must be 9 or 18".
|
||||
3. The player category must be M (member), G (guest) or J (junior). If it is
|
||||
not, raise {{P}}CX_GOLF with the reason INVALID_CATEGORY and the message
|
||||
"Player category must be M, G or J".
|
||||
4. The tee hour must be between 6 and 20. If it is not, raise {{P}}CX_GOLF with
|
||||
the reason INVALID_TEE_HOUR and the message "Tee hour must be between 6 and
|
||||
20".
|
||||
5. Check the rules 1 to 4 in this order. Raise only the first exception that
|
||||
applies.
|
||||
6. The green fee per player for 18 holes is 25.00 for a member, 62.50 for a
|
||||
guest and 12.50 for a junior. For 9 holes the green fee per player is half
|
||||
of the green fee per player for 18 holes.
|
||||
7. Twilight rate: if the tee hour is 18 or later, reduce the green fee per
|
||||
player by 25 %. Round the result half up to 2 decimals.
|
||||
8. The total fee is the green fee per player times the number of players.
|
||||
9. Group discount: if the booking has 4 players, reduce the total fee by 10 %.
|
||||
Round the result half up to 2 decimals. Apply this discount after the
|
||||
twilight rate.
|
||||
10. If the booking is valid, return the total fee in ev_fee and raise no
|
||||
exception.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: 8.16.
|
||||
- Coding standards: Clean ABAP. Keep every method below 40 statements.
|
||||
- Out of scope: none.
|
||||
|
||||
# 7. Acceptance
|
||||
- The exception class and the function module are active and have no syntax
|
||||
error.
|
||||
- The hidden tests pass.
|
||||
- Write ABAP Unit tests for the function module in a global test class.
|
||||
Reference in New Issue
Block a user