当前位置:首页 > 网上商城 > 正文内容

求Java语言为书城设计一个简单购物车类。

访客2021-09-26 14:51:26网上商城44

public class ShoppingCart {//购物车类
    private Producted prod;//商品类,存放商品信息
    private int num;//商品数量
    public Producted getProd() {
        return prod;
    }
    public void setProd(Producted prod) {
        this.prod = prod;
    }
    public int getNum() {
        return num;
    }
    public void setNum(int num) {
        this.num = num;
    }
}
public class Producted {//商品类
    private String prodName;//商品名称
    private Double marketPrice;//市场价
    private Double sellPrice;//本店价
    private Double save;//优惠
    private Short points;//积分
    public String getProdName() {
        return prodName;
    }
    public void setProdName(String prodName) {
        this.prodName = prodName;
    }
    public Double getMarketPrice() {
        return marketPrice;
    }
    public void setMarketPrice(Double marketPrice) {
        this.marketPrice = marketPrice;
    }
    public Double getSellPrice() {
        return sellPrice;
    }
    public void setSellPrice(Double sellPrice) {
        this.sellPrice = sellPrice;
    }
    public Double getSave() {
        return save;
    }
    public void setSave(Double save) {
        this.save = save;
    }
    public Short getPoints() {
        return points;
    }
    public void setPoints(Short points) {
        this.points = points;
    }
}
有用请采纳

分享给朋友:

相关文章