cartitem.java
来自「基于 C/S 模式的网上购物系统」· Java 代码 · 共 41 行
JAVA
41 行
package RegisterAndLogin;
//购物车中的一个条目
import java.io.Serializable;
class CartItem implements Serializable
{
merchandise goods=null;
int quantity=0;
public CartItem(merchandise goods)
{
this.goods=goods;
this.quantity=1;
}
public void setgoods(merchandise goods)
{
this.goods=goods;
}
public merchandise getgoods()
{
return goods;
}
public int getQuantity()
{
return quantity;
}
public void setQuantity(int quantity)
{
this.quantity=quantity;
}
public float getItemPrice()
{
float price=goods.getPrice()*quantity;
long val=Math.round(price*100);
return val/100.0f;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?