basket.java

来自「我做的ssd9 exercise6 的答案。分享」· Java 代码 · 共 68 行

JAVA
68
字号
/**
 * 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 + =
减小字号Ctrl + -
显示快捷键?