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

📄 cartitembean.java

📁 Java.Web开发详解.书中例子的源代码
💻 JAVA
字号:
package org.sunxin.lesson.jsp.bookstore;

import java.io.Serializable;

public class CartItemBean implements Serializable
{
    private BookBean book=null;
    
    //表示选购的图书的数量
    private int quantity=0;
    
    public CartItemBean()
    {
    }
    
    public CartItemBean(BookBean book)
    {
        this.book=book;
        this.quantity=1;
    }
    
    public void setBook(BookBean book)
    {
        this.book = book;
    }
    
    public BookBean getBook()
    {
        return book;
    }
    
    public void setQuantity(int quantity)
    {
        this.quantity = quantity;
    }
    
    public int getQuantity()
    {
        return quantity;
    }
    
    /**
    *得到本条目所购图书价格的合计,总价 = 图书的单价 * 数量。
    */
    public float getItemPrice()
    {
        float price=book.getPrice()*quantity;
        long val=Math.round(price*100);
        return val/100.0f;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -