Last active
July 15, 2023 19:14
-
-
Save yattom/884741ecbd3c660fb393b2d7b116b4b2 to your computer and use it in GitHub Desktop.
プログラミングのお題: 自動販売機 (設計進化重視バージョン)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 自動販売機のプログラムをTDDで書いてみよう! | |
| 飲み物の自動販売機の動きを、プログラムで表現してください。 | |
| 最終的な自動販売機の全機能は、不確定です。テスト駆動開発のアプローチを有効活用して、進化的に設計をどんどん変えていきましょう。 | |
| ## 命名のヒント | |
| 自動販売機のプログラムを書こうとすると、いろいろな英語表現を知っていると便利です。まずは英語版のWikipediaを見てみると、いろいろな言葉を拾えます。以下にいくつかの例を挙げます。。 | |
| https://en.wikipedia.org/wiki/Vending_machine | |
| * 自動販売機 = Vending Machine | |
| * 受け取り口 = cup, open compartment | |
| * 商品 = item, product | |
| * 飲み物 = beverage | |
| * (コインを)投入する = insert | |
| * (商品を)排出する = dispense | |
| * 支払い = payment | |
| ## お題1. ボタンを押すとコーラが出る | |
| ボタンを押すとコーラが出ます。 | |
| ## お題2. お金を払う | |
| 100円コインを投入してからボタンを押すとコーラが出ます。100円コイン以外は投入できません。 | |
| ## お題3. ウーロン茶追加 | |
| 押したボタンに応じてコーラかウーロン茶が出ます。 | |
| ## お題4. レッドブル | |
| 200円入れるとレッドブルも買えます。 | |
| ## お題5. ボタンが光る | |
| 入れたお金に応じて、買えるもののボタンが光ります。 | |
| ## お題5. 使えるコイン | |
| 100円コインの他に、10円、50円、500円コインも使えます。 | |
| ## お題6. お釣り | |
| ボタンを押して飲み物を買うと、お釣りが出ます。 | |
| ## お題7. 返却ボタン | |
| 飲み物を買わなくても、返却ボタンを押すと投入したお金が戻ってきます。 | |
| # 未確定の仕様 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment