# IntentScript 仕様読み込み
include: https://github.com/yosugi/intent-script
warikan_app:
calculation_rule: |
総額を人数で等分した基準額から、
各タイプごとに端数処理を行い、
主催者が最終的な差額を負担する
# 端数処理関数の定義
rounding_functions:
round_down_100:
logic: |
1000円単位で切り捨て。
実装: Math.floor(amount / 1000) * 1000
例:4,800円 → 4,000円
round_up_100:
logic: |
1000円単位で切り上げ。
実装: Math.ceil(amount / 1000) * 1000
例:4,800円 → 5,000円
participant_types:
student:
rounding: round_down_100
worker:
rounding: round_up_100
organizer:
role: final_adjuster
logic: |
端数処理は行わず、総額から他の参加者の支払総額を引いた残額を負担。
calculation_flow:
- step1: "総額 ÷ 人数 = 基準額"
- step2: "学生・社会人は基準額から端数処理"
- step3: "主催者 = 総額 - (学生支払額 + 社会人支払額)"
example:
total: 24000
participants:
- {type: organizer, count: 1}
- {type: worker, count: 2}
- {type: student, count: 2}
result:
student: 4000 # 4800 → 4000 (切り捨て)
worker: 5000 # 4800 → 5000 (切り上げ)
organizer: 6000 # 24000 - 18000
technical_requirements:
framework: "TypeScript + React"
design: "レスポンシブデザイン"
validation: "入力値のバリデーション"
display: "計算過程の表示"
Created
June 20, 2025 10:59
-
-
Save yosugi/a748665f73e3c176017b51d772dce66d to your computer and use it in GitHub Desktop.
飲み会などの割り勘計算を自動化するWebアプリケーション。参加者のタイプに応じて異なる端数処理を行い、主催者が最終的な差額を調整する。
- 総額の入力
- 参加者情報の入力(名前、タイプ、人数)
- 割り勘金額の自動計算
- 計算結果の表示
- 学生:支払額を抑えたい参加者
- 社会人:通常の参加者
- 主催者:幹事役で調整額を負担する参加者(1人のみ)
- 総額を全参加者数で等分して基準額を算出
- 各参加者タイプごとに端数処理を実施
- 主催者が残りの金額を全額負担
- 学生:基準額の100の位で切り捨て(例:4,800円 → 4,000円)
- 社会人:基準額の100の位で切り上げ(例:4,800円 → 5,000円)
- 主催者:端数処理なし。総額から他の参加者の支払総額を引いた残額を負担
- 総額:24,000円
- 参加者:主催者1人、社会人2人、学生2人(計5人)
- 基準額:24,000円 ÷ 5人 = 4,800円
- 結果:
- 学生:4,000円/人(4,800円を切り捨て)
- 社会人:5,000円/人(4,800円を切り上げ)
- 主催者:6,000円(24,000円 - 8,000円 - 10,000円)
- TypeScript + React使用
- レスポンシブデザイン
- 入力値のバリデーション
- 計算過程の表示
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment