⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basket.java

📁 我做的ssd9 exercise6 的答案。分享
💻 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 + -