
you are here
319
9
章
Iterator
パターンと
Composite
パターン
public class MenuItem {
String name;
String description;
boolean vegetarian;
double price;
public MenuItem(String name,
String description,
boolean vegetarian,
double price)
{
this.name = name;
this.description = description;
this.vegetarian = vegetarian;
this.price = price;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public double getPrice() {
return price;
}
public boolean isVegetarian() {
return vegetarian;
}
}
メニューの項目を調べる
オブジェクト町食堂
ベジタリアン
BLT 2.99
レタス、トマト、(フェイク)ベーコンをはさん
だ全粒小麦パンサンドイッチ
BLT
レタス、トマト、ベーコンをはさんだ全粒小麦パ
ンサンドイッチ
今日のスープ
ポテトサラダを添えた本日のスープ ...