• 大小: 1.57M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2024-04-10
  • 语言: Java
  • 标签: 宠物  

资源简介

在前端选择要买的宠物,然后提交付款

资源截图

代码片段和文件信息

package bean;
import java.util.*;
public class Cart {
private ListcartItemList=new ArrayList<>();
private MapcartItemMap=new HashMap<>();
public List getCartItemList() {
return cartItemList;
}
public void addItemToCart(Item it) {
CartItem ci=cartItemMap.get(it.getItemid());
if(ci==null) {
ci=new CartItem();
ci.setIt(it);
ci.setQuantity(1);
cartItemList.add(ci);
cartItemMap.put(it.getItemid() ci);
}
else
ci.incrementQuantity();
}

public void removeItemByItemid(String itemid) {
CartItem ci=cartItemMap.remove(itemid);
if(ci!=null)
cartItemList.remove(ci);
}
public int getNumberOfItems() {
int num=0;
for(CartItem ci:cartItemList)
num+=ci.getQuantity();
return num;
}
public double getTotal() {
double total=0;
for(CartItem ci:cartItemList) {
total+=ci.getTotalprice();
}
return total;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-07-06 15:02  Petstore\
     文件         645  2020-06-02 00:10  Petstore\.classpath
     文件         908  2020-04-30 09:59  Petstore\.project
     目录           0  2020-07-06 15:02  Petstore\.settings\
     文件         567  2020-04-30 09:59  Petstore\.settings\.jsdtscope
     文件         364  2020-04-30 09:59  Petstore\.settings\org.eclipse.jdt.core.prefs
     文件         476  2020-04-30 09:59  Petstore\.settings\org.eclipse.wst.common.component
     文件         345  2020-04-30 09:59  Petstore\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2020-04-30 09:59  Petstore\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2020-04-30 09:59  Petstore\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2020-07-06 15:02  Petstore\build\
     目录           0  2020-07-06 15:02  Petstore\build\classes\
     目录           0  2020-07-06 15:02  Petstore\build\classes\bean\
     文件        2176  2020-06-10 10:57  Petstore\build\classes\bean\Cart.class
     文件        1367  2020-06-05 09:42  Petstore\build\classes\bean\CartItem.class
     文件        1353  2020-06-02 00:10  Petstore\build\classes\bean\Category.class
     文件        1150  2020-06-02 00:10  Petstore\build\classes\bean\Inventory.class
     文件        3416  2020-06-02 00:10  Petstore\build\classes\bean\Item.class
     文件        1634  2020-06-02 00:10  Petstore\build\classes\bean\Product.class
     目录           0  2020-07-06 15:02  Petstore\build\classes\business\
     文件         676  2020-06-02 16:10  Petstore\build\classes\business\PetStore.class
     文件        1719  2020-06-02 16:42  Petstore\build\classes\business\PetStoreImpl.class
     目录           0  2020-07-06 15:02  Petstore\build\classes\dao\
     文件         997  2020-06-02 00:10  Petstore\build\classes\dao\baseDao.class
     文件        3126  2020-06-02 00:10  Petstore\build\classes\dao\CategoryDao.class
     文件        3106  2020-06-02 00:10  Petstore\build\classes\dao\InventoryDao.class
     文件        4187  2020-06-02 00:10  Petstore\build\classes\dao\ItemDao.class
     文件        3486  2020-06-02 00:10  Petstore\build\classes\dao\ProductDao.class
     目录           0  2020-07-06 15:02  Petstore\build\classes\filter\
     文件        2173  2020-06-02 18:30  Petstore\build\classes\filter\LogFilter.class
     目录           0  2020-07-06 15:02  Petstore\build\classes\myservlet\
............此处省略102个文件信息

评论

共有 条评论