?? basket.java
字號:
/**
* Each dustomer has a basket.
* The basket class is used by BasketController.
* A basket object contains a collection class (products vector)
* which contains the product the dustomer would like to buy.
*/
import java.util.*;
public class Basket {
private Vector products;
/**
* Class constructor.
*/
public Basket(){
products=new Vector();
}
/**
* Add a product to a customer's basket.
* In this method, we just need add it to the collection class of the basket.
*
* @param p the product's object to added.
*/
public void add(Product p){
//body
}
/**
* Delete a product from a customer's basket.
* In this method, we just need to remove it from the basket's collection class.
*
* @param p the product's object to be deleted.
*/
public void delete(Product p){
//body
}
/**
* Clear all the products in the basket if the customer would like.
* the method invoke the vector's clear method to clear the collection class.
*
*/
public void clear(){
//body
}
/**
* Gets products of the basket.
*
* @return the collection class(vector) of this class
*/
public Vector getProducts(){
return products;
}
/**
* Set products of the basket.
*
* @param products a vector
*/
public void setProducts(Vector products){
this.products=products;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -