Head First Object-Oriented Analysis and Design
A Brain Friendly Guide to OOA&D
(O'Reilly Media)
Brett McLaughlin (著),Gary Pollice (著)
David West (著)
邦訳
Head Firstオブジェクト指向分析設計
頭とからだで覚えるオブジェクト指向の基本
長瀬 嘉秀 (編集), 永田 渉 (編集)
株式会社テクノロジックアート (翻訳)
開発環境
- OS X Yosemite - Apple (OS)
- Emacs (CUI)、BBEdit - Bare Bones Software, Inc. (GUI) (Text Editor)
- Java (プログラミング言語)
- javac (コンパイラ)
- java (application launcher)
Head First Object-Oriented Analysis and Design: A Brain Friendly Guide to OOA&D (Brett McLaughlin (著)、Gary Pollice (著)、David West (著)、 O'Reilly Media)のChapter 2. Gathering Requirements: Give Them What They Want、CODE MAGNETS(No. 1518)を解いてみる。
その他参考書籍
CODE MAGNETS(No. 1518)
コード(BBEdit, Emacs)
DogDoorSimulator.java
public class DogDoorSimulator {
public static void main(String[] args)
{
DogDoor door = new DogDoor();
Remote remote = new Remote(door);
System.out.println("Fido barks to go outside...");
remote.pressButton();
System.out.println("\nFido has gone outside...");
System.out.println("\nFido's all done...");
try {
Thread.currentThread().sleep(10000);
} catch (InterruptedException e) {}
System.out.println("...but he's stuck outside.");
System.out.println("\nFido starts barking...");
System.out.println("...so Todd grabs the remote control.");
remote.pressButton();
System.out.println("\nFido's back inside...");
}
}
入出力結果(Terminal)
$ jrun.sh DogDoorSimulator Fido barks to go outside... Pressing the remote control button... The dog door opens. Fido has gone outside... Fido's all done... The dog door closes. ...but he's stuck outside. Fido starts barking... ...so Todd grabs the remote control. Pressing the remote control button... The dog door opens. Fido's back inside... The dog door closes. $
0 コメント:
コメントを投稿