|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.ObjectShoppingSystem
public class ShoppingSystem
演習2の買い物をするプログラムのスケルトン. メソッドなり属性なり付け足して完成してください. 無論,必要なクラスを付け足さないといけないかもしれません. TODO 自分で改造すべし
フィールドの概要 | |
---|---|
private HashSet<Customer> |
rcustomers
登録されている顧客の集合. |
private HashSet<Product> |
rproducts
登録されている商品の集合 |
コンストラクタの概要 | |
---|---|
ShoppingSystem()
|
メソッドの概要 | |
---|---|
boolean |
addCustomer(String c)
cを新規顧客として登録する |
boolean |
addProduct(String p)
p を新規の商品として登録する |
boolean |
buyProduct(Customer c,
Product p,
int n)
顧客 c が 商品 p を n 個買う. |
boolean |
buyProduct(String c,
String p,
String n)
顧客 c が 商品 p を n 個買う. |
Customer[] |
getCustomers()
現状登録されている全ての顧客の配列を返す |
Product[] |
getProducts()
現状登録された全ての商品のリストを返す |
HashSet<Customer> |
getRcustomers()
|
HashSet<Product> |
getRproducts()
|
private boolean |
isOverlap(HashSet<Product> set1,
HashSet<Product> set2)
二つの集合の交わりがあるかどうかテスト. |
Product[] |
recommendProducts(Customer c)
顧客 c に勧める商品を計算 |
String[] |
recommendProducts(String c)
顧客 c に勧める商品を計算 |
void |
setRcustomers(HashSet<Customer> rcustomers)
|
void |
setRproducts(HashSet<Product> rproducts)
|
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
private HashSet<Customer> rcustomers
private HashSet<Product> rproducts
コンストラクタの詳細 |
---|
public ShoppingSystem()
メソッドの詳細 |
---|
public HashSet<Customer> getRcustomers()
public void setRcustomers(HashSet<Customer> rcustomers)
public HashSet<Product> getRproducts()
public void setRproducts(HashSet<Product> rproducts)
public boolean addCustomer(String c)
c
- 追加する顧客名
public boolean addProduct(String p)
p
- 追加する商品名
public boolean buyProduct(String c, String p, String n)
c
- 買う顧客p
- 買う商品名n
- 個数の文字列表現
public boolean buyProduct(Customer c, Product p, int n)
c
- p
- n
-
public String[] recommendProducts(String c)
c
- 勧めたい顧客
public Product[] recommendProducts(Customer c)
c
-
private boolean isOverlap(HashSet<Product> set1, HashSet<Product> set2)
set1
- set2
-
public Product[] getProducts()
public Customer[] getCustomers()
|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |