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 5. Good Design = Flexible Software: Give Your Software a 30-minute Workout、INVENTORY ROUNDUP(No. 3337)を解いてみる。
その他参考書籍
INVENTORY ROUNDUP(No. 3337)
コード(BBEdit, Emacs)
FindInstrument.java
import java.util.Map;
import java.util.HashMap;
public class FindInstrument {
public static void main(String[] args) {
/* ... */
}
private static void initializeInventory(Inventory inventory) {
/* ... */
properties.put("builder", Builder.Martin);
properties.put("model", "D");
properties.put("topWood", Wood.Adirondack);
properties.put("backWood", Wood.MAHOGANY);
inventory.addInstrument("122784", 5495.95,
new InstrumentSpec(properties));
properties.put("builder", Builder.Fender);
properties.put("model", "stratocastor");
properties.put("type", Type.ELECTRIC);
properties.put("topWood", Wood.ALDER);
properties.put("backWood", Wood.ALDER);
inventory.addInstrument("V95693", 1499.95,
new InstrumentSpec(properties));
inventory.addInstrument("V9512", 1549.95,
new InstrumentSpec(properties));
properties.put("builder", Builder.GIBSON);
properties.put("model", "5G");
properties.put("topWood", Wood.MAHOGANY);
properties.put("backWood", Wood.MAHOGANY);
inventory.addInstrument("82765501", 1809.05,
new InstrumentSpec(properties));
properties.put("model", "Les Paul");
properties.put("topWood", Wood.MAPLE);
properties.put("backWood", Wood.MAPLE);
inventory.addInstrument("70108276", 2295.95,
new InstrumentSpec(properties));
properties.put("instrumentType", InstrumentType.MANDOLIN);
properties.put("model", "F5-G");
properties.put("type", Type.ACOUSTIC);
properties.remove("numStrings")
inventory.addInstrument("9019920", 5495.99,
new InstrumentSpec(properties));
properties.put("instrumentType", InstrumentType.BANJO);
properties.put("model", "RB-3");
properties.put("type", Type.ACOUSTIC);
properties.put("numStrings", 5);
properties.remove("topWood");
inventory.addInstrument("8900231", 2945.95,
new InstrumentSpec(properties));
}
}
0 コメント:
コメントを投稿